UIViewcontroller's view frame starting at unexpected location - ios7

We are started to convert our iOS 6 application into iOS 7. I tried to create one screen for my application. I used Xib file for design, I designed the screen from top to bottom with UILabel and UIButtons. When I tried to run the app in Simulator it showing differently from xib design. In simulator the designs are came down and bottom UILabel has hide.
I got the self.view.frame from viewDidLoad() was (0,64,32,504). But, it is showing correctly in viewDidAppear (0,0,320,568).
How can I resolve this issue in Xcode 5? Could you please help me to solve this.Looking forward your reply. Thanks.

You cannot depend on the frame in -viewDidLoad, because it hasn't been resized for the device at that point. You need to wait for -viewDidAppear.

Related

My UITableViewCell containing a UIScrollView stopped scrolling vertically in iOS 9

I just noticed a behavior change that seems related to migrating to iOS 9.
I have a UITableView. In the first UITableViewCell I have a UIScrollView that I use to page through images. It should only scroll left<-->right. Finger dragging up and down should drag the UITableView up and down. Up until iOS 9 it did do that beautifully... Now when I compile for iOS9 devices or simulator I can still scroll the images left<-->right but the table no longer scrolls up and down. Those touches just get sucked into the abyss.
Let me add that when I compile from Xcode 7 to my device running iOS 8.4 it still behaves as intended. Scrolls up and down when dragging in the embedded UIScrollView.
Furthermore, when I download my last released version (compiled on previously released Xcode for iOS 8.1 target I get the expected behavior on the iOS 9 phone.
Additional wrinkle of weirdness: if (back in xcode7 compiling live to iOS9 device again) I start scrolling vertically from one of the other cells and the table is still gliding to a stop THEN I CAN drag up and down from the UIScrollView. What the heck?
Anything obvious jump out here?
Thanks,
Bill
Something in iOS 9 changes with respect to self's frame, apparently. I had to change this:
self.scrollView.contentSize = CGSizeMake(self.frame.size.width*self.pageImages.count, self.frame.size.width);
to this:
self.scrollView.contentSize = CGSizeMake(self.frame.size.width*self.pageImages.count, self.window.frame.size.width);
See that reference to window in the final version? Second time that bit me. :)

In Xcode my UIButton is centered, however when I build and run the app it isn't. How do I fix this?

In Xcode my UIButton is centered and locked in the right place using the grids but when I run the app I'm building from a tutorial I'm following the button is slightly to the right.
Is there a quick fix for this other than shifting the button to the left in Xcode until it's centered in simulator which is pointless because the guides in Xcode are there to help so I'd like to take advantage of them and not need to do this.
Make sure you have unchecked the use Autolayout option for your Xib.
if is horizontal centered image, try like this:
ps: make sure that the parent view of the UIButton is also centered in the screen
After updating XCode I realised the issue was that XCode was launching ios simulator for 3.5inch iphone. I changed the device to iphone 4inch retina and this fixed the issue.

iPhone 5 retina 4 inch touch screen

I'm adapting my app to iphone 5 and I've got a problem. I saw all documentation regarding this and it didn't work yet.
I put the Default-568h#2x.png and everything resized successfully.
The problem is in the touch stuff. I've got a toolbar on the bottom and when I touch it nothing happens :( in the retina 4" simulator. Works fine in retina 3.5
In retina 4", if I set the toolbar in the inspector above 439 px in the Y position works fine. Anything below this makes my toolbar not to work.
As I said, I tried many many things unsuccessfully.
I'm using Xcode 4.6.1, I've got a Main View (not having a Window option in the Attributes inspector).
Thanks in advance.
Your window or the main view is not resizing correctly. Make sure you have set them up such that they autoresize in both directions. Try to set different background colors to your views to find the view that is not resizing correctly.
Ensure that all of your views are auto-resizing correctly to fill the screen. It sounds like the main container view you have isn't being resized and is drawing the toolbar outside of its frame. This will work from a visual point of view as UIView - clipsToBounds defaults to NO, but touches won't work outside the frame.

xCode: setView always portrait though device in Landscape

I have encountered a problem developing an iPad app with xCode.
When I load a view into my rootViewController like this
[self setView:viewController.view];
The view is always displayed in Portrait even though the device is rotated to landscape.
I checked all options and tried changing the shouldAutoRotateToOrientation method and it seems to have nothing to do with it.
If I rotate the device to portrait and then back to landscape it works.
Does anybody know why this is happening?
Best regards,
Matteo
The problem was that I was nesting viewControllers which leads to bad behavior like rotation notifications not being sent to certain ViewControllers.

Black screen when loading iPad Storyboard.

So I am working on an app https://github.com/Kronusdark/PerlinNoiseKit and I had a (crappy) iPhone UI going, but I decided to make it run on my iPad. The problem is that when it loads the iPad storyboard, I get a black screen. I have checked my project summary and it is pointing to the correct storyboard file. The outlets all appear to be set correctly, and it will actually run code in my viewController on my iPad. I just get no UI. I have pushed my most recent changes to my repo if anyone wants to try to run it, any advice would be helpful.
Eureka! It turns out one of my sub-views were not working properly. After I removed the offending view my storyboard loaded no problem. I believe it was due to a rogue drawRect:.