iPhone 5 UITableView - iphone

I am trying to update my App for the iPhone 5's larger screen real estate. I have a tableview that has expanded to take up the full height of the screen by adding the Default-568h#2x.png to my project, but the bottom couple of cells are not responding to touched in the simulator or the actual iPhone 5. Am I missing something? It's like the bottom portion of the screen is not detecting touched (but just in my App not the others).
Any thoughts?
Thanks,
Rob

This is whats working for me
In application didFinishLaunching method I added this -
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
In any other view controller, preferably in - (void)viewDidLoad;
UIScreen *screen = [UIScreen mainScreen];
[self.view setFrame:[screen applicationFrame]];

Yes may be your window frame size in AppDel class or in XIB file of your project's appdel class is not as per iPhone 5 Screen.
And change window frame according 3.5 inch and 4 inch screen of iPhone

Related

Convert iphone 4 app into iphone 5

We have update our application to support both iPhone 4 and iPhone 5 screen size. It is working fine in both simulators but when we install it on iPhone 5 device then it behaves like iphone 4 application (Black borders on top and bottom). We have also added Default-568h#2x.png bot not working correctly. We are creating window dynamically.
What we are missing here ? Any ideas ?
Also how to set "Full Screen At Launch" property of UIWindow programmatically ?
Here is one solution that worked
A. In your AppDelegate.m initialize the UIWindow object like this
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]
B. In order to manage other UI Elements You can define a macro that provides current frame of the screen be it iPhone 4/iPhone 5
#define SCREEN_FRAME [[UIScreen mainScreen] applicationFrame]
Accordingly you can use SCREEN_FRAME width/height properties to adjust other UI elements
Hope this helps.

StatusBar and RootViewController on iOS 6

My app has been running fine for a couple years, but there have been several hiccups with the release of iOS 6 and one of them is a problem with StatusBar orientation.
My app works in either Landscape orientation, but touches were vertically off by the width of the status bar in one of the two orientations. Intuitively, it seemed that even though the status bar image was being relocated properly during rotation, the LOGICAL position of the status bar was not changing -- and thus consuming touches on the wrong side of the screen.
In my Info.plist file "UIStatusBarHidden" was set to FALSE. In my App Delegate's "didFinishLaunchingWithOptions" function I created my own custom ViewController and set it as the RootViewController for the Window. Even though this worked prior to iOS 6, I believe it is at this point that the StatusBar did not "transfer" to the new RootViewController.
I theorized that prior to iOS 6 my code worked because orientation changes got propagated to the OLD RootViewController and caused orientation to work as expected. Since iOS 6 no longer propagates orientation beyond the NEW RootViewController, the OLD controller (which "logically" contained the StatusBar) never got updated.
Note: my app does not have a .XIB file and does not explicitly create a RootViewController until this point. But I think a default one was created for me behind the scenes anyhow.
My "solution" was to set "UIStatusBarHidden" to TRUE in the Info.plist file and manually set it to FALSE in code at a point AFTER I've set my custom RootViewController. This seems to work, but I may have addressed the symptom instead of the actual problem.
I'm also worried about side-effects because other things besides StatusBar could still be logically tied to that old/implicit RootViewController and they aren't getting "transferred" to the new one either.
Does anyone have similar experience with StatusBar and/or RootViewController? Is this approach ok or should I leave the default/implicit RootViewController in place and somehow add my ViewController to it as a child? That didn't seem to work when I first wrote the code two years ago, which lead to my current implementation.
Below are the highlights of the code in questions. Thanks in advance for the advice.
-BT
// ******** Info.plist value *********
<key>UIStatusBarHidden</key>
<true/>
// ******** App Delegate **********
- (BOOL)application : (UIApplication *)application didFinishLaunchingWithOptions : (NSDictionary *)launchOptions
{
CGRect rect = [[UIScreen mainScreen] applicationFrame];
rect.origin.x = 0; rect.origin.y = 0;
self.window = [[[UIWindow alloc] initWithFrame:rect] autorelease];
self.gameViewController = [[[GameViewController alloc]init] autorelease];
self.gameView = [[[GameView alloc] initWithFrame:rect] autorelease];
[self.gameViewController.view addSubview : self.gameView];
[self.window setRootViewController:self.gameViewController];
// Setting it now attaches it to our actual RootViewController instead of the
// "phantom" controller created under the hood?
[UIApplication sharedApplication].statusBarHidden = NO;
// ...
}

How to show iPhone size views on iPad applications

I have an iPhone application (app1) which has to be integrated as a sub-application on another universal iOS app (app2).
For various reasons I don't want to create an iPad interface for my iPhone app1, I just want that all the views will be shown with iPhone dimensions (at the center of the screen) also when the main app2 is executed on an iPad. On app1 I do not support landscape orientation, only portrait.
Is this somehow possible to realize?
Thank you in advance.
This is the code!
UIPopoverController *popoverController = [[UIPopoverController alloc] initWithContentViewController:yourViewController];
[popoverController setPopoverContentSize:CGSizeMake(320, 480)];
And to show the popoverController in the middle of the iPad screen
UIDevice* thisDevice = [UIDevice currentDevice];
if(thisDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad){
[popOverController presentPopoverFromRect:CGRectMake(380, 450, 1, 1) inView:self.view permittedArrowDirections:0 animated:YES];
}
To maintain always the same size of your UIPopoverController do not forget to set the contentSizeForViewInPopover in each view (do this inside the viewWillAppear:)
- (void)viewWillAppear:(BOOL)animated{
[self setContentSizeForViewInPopover:CGSizeMake(320, 480)];
}
Yes - you can do this. Assuming you have built your original application using UIViewControllers, the iPad has a special kind of class called a UIPopoverController where you can spawn a UIViewController onto the screen of the iPad at a given size.
To embed an iPhone app in a iPad app, set the root UIViewController of your iPhone App to the View Controller in the Popover Controller, set the size of the popover to 320x640 and spawn it by calling the presentPopover function.
I hope this helps!
N

iPad touch detected only in 320x480 region

I'm upgrading iPhone app and so far everything is going well (managed to resize screen display for most forms). However, I can't solve one problem - the touch is detected only in old, 320x480 region. Any ideas how can I solve that?
Thanks
EDIT: Here are the results when code for fetching superview bounds executes:
CGFloat wdth = self.view.superview.bounds.size.width;
NSLog(#"%d", wdth);
CGFloat hgth = self.view.superview.bounds.size.height;
NSLog(#"%d", hgth);
Result:
2010-04-16 14:25:36.268 xxx[14871:207] 0
2010-04-16 14:25:36.269 xxx[14871:207] 1073741824
Result for (%f):
2010-04-16 14:37:26.048 xxx[15053:207] -1.998374
2010-04-16 14:37:26.049 xxx[15053:207] 0.000000
Result for (%g):
2010-04-16 14:37:41.113 xxx[15084:207] -1.99837
2010-04-16 14:37:41.115 xxx[15084:207] 9.48221e-38
http://iphonedevelopment.blogspot.com/2010/04/converting-iphone-apps-to-universal.html
In you AppDelegate:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// stupid Apple...
CGRect rect = [[UIScreen mainScreen] bounds];
[window setFrame:rect];
// now, display your app
[window addSubview:rootController.view];
[window makeKeyAndVisible];
}
In interface builder make sure that mainwindow-iPad "Full screen at launch" window attribute is checked.
I have seen similar behavior when a container view is set too small. The subviews will display fine but touches will not fire because the touches are happening outside of the superview.
The real problem here is that in the file MainWindow-iPad.xib, the Window object gets created with a size of 320 x 480. As ayman2010 mentions, setting the "Full screen at launch" fixes this.
Why would apple create an iPad window so small!!!???
You may also open the (automatically created) MainWindow-iPad.xib in Interface Builder, select File/Create iPad Version, close the MainWindow-iPad.xib and save the unnamed new XIB (which has the correct size) over the old one.
BurninLeo

ABPeoplePickerNavigationController

This is probably a really basic question, but when I make my ABPeoplePickerNavigationController instance (addBookViewer)visible by running,
[self presentModalViewController:addBookViewer animated:YES]
the contact view pops up, but is cut off by the top most bar of the display (the bar showing the AT&T signal strength, clock and battery charge). Is there a way to programatically change the addBookViewer so that it is not cut off by the static status bar?
Thanks,
Dave
It looks like ABPeoplePickerNavigationController inherits from UIViewController. Perhaps you could try editing the view's frame before presenting it:
addBookViewer.view.frame = CGRectMake(0, 20, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height - 20);
I suspect it is because the view controller that you are calling presentModalViewController:animated: on has a frame that is also being covered, but you don't notice, probably have plenty of head room, make sure you have the status bar in your nib file so that it is laid out correctly.