What to do about modal "done" button on iPad - iphone

Edit:
After thinking about this again. I realized what I was trying to do was use a modal view controller on the iPad. I was under the impression that according to the HIG, I couldn't use a "done" button in a popover. I obviously need a "done" button on the iPhone but I am trying to handle that modal view in a popover.

yes its possible
create one complete code in iphone size view control.
now when you want to show on that find the device
Example
you create one controller name mytable.m,.h and .xib in iphone size
one button click you want to show this mytable view
button click event is
-(void)btnshowtableclick:(id)sender
{
NSString *deviceType = [UIDevice currentDevice].model;
if([deviceType isEqualToString:#"iPhone"])
{
//navigate to that screen code
}
else
{
//show popover
}
}
Determine device (iPhone, iPod Touch) with iPhone SDK

Apparently using a "done" button to dismiss a modal view controller is allowed since I can set the modalInPopover property and add my "done" button to the navcontroller bar.

Related

Alert needs to show as popover within iPhone

The view customization:
As UIAlertController shows in iPad in popover style. Is it possible to show alert as popover within iPhone devices as well?

Done button hides in "more" tab on changing the orientation in iPhone

I have made a tabbar application with 7 tabs. When i start it in portrait mode,on clicking "more" tab it shows edit button and on clicking edit,done button appears .Now when i change the orientation of my device to landscape,done button hides.
You need to call this method. this method is executed when rotate to landscape mode....
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
[Button setHidden:YES];
}

pushviewcontroller iPhone sdk - changing views UITabBar

I have a uitabbar application, and I would like to hide the UITabbar whenever a viewcontroller slides in (it is a tableview so whenever a row is tapped).
I would like the tab bar to hide whenever a viewcontroller is pushed and would like the entire screen to be covered with this new view like in iPod application of iPhone.
Just set the UIViewController hidesBottomBarWhenPushed proprety to YES before you push the viewcontroller.
viewController.hidesBottomBarWhenPushed = YES;

UIPopoverController in SplitViewController

I have a fairly complicated issue which I will describe as good as possible.
I have an iPad App and a SplitviewController as my main view. In Portrait mode, the SplitviewController hides the Tableview to the left, so that the DetailviewController is visible only. So far so good.
The way you use this, is, from what I understand, that if I tap on a cell to the left, I replace the Detailview to the right with a new view I want to show. To this end, I use the viewControllers property.
Now to display the Popover I have a Toolbar at the top and a Menu Button to display the Popover.
Here's the thing:
I tap on a cell, and replace the DetailviewController with a new Viewcontroller. But now the Popovercontroller is gone, since it was declared in the header of the old ViewController.
The problem: When I tap on the Menu Button in port mode, the popover cant be displayed, since it is nil now, as it wasnt initiated yet.
But what I can do is: I rotate the iPad to the landscape, and rotate it back again. The popover is back, bacause in the delegate method of the splitviewcontroller the following happens:
- (void) splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {
self.popoverController = pc;
}
Where does this pc come from? How can I do that myself.
If I try to re-alloc the Popovercontroller this breaks the SplitviewController and artifacts in the App appear.
I hope I explained my problem well enough.
Any ideas?
Take a look at this sample code from Apple:
http://developer.apple.com/library/ios/samplecode/MultipleDetailViews/Introduction/Intro.html
It demonstrates how to switch between different detail views by tapping on items in the table in the split view app's lefthand view.

iPhone TabBar selection cancelling

I am developing an iPhone app that displays several views, all acessed via Tab Bar items. However I need to add an additional item to the Tab Bar that simply launches a URL in Safari.
I've accomplished this by adding an empty placeholder view to the TabBar and returning FALSE from shouldSelectViewController when the this view's tabBarItem is clicked on, and launching Safari at the same time.
That code is:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
if([[viewController tabBarItem] title] == "Website"){
//... launch Safari
return FALSE;
} else {
return TRUE;
}
}
PROBLEM: If the TabBar has too many items, and this "Safari Launch" tab is pushed off to the "More" navigation controller, I lose the capability to intercept the event and prevent the view from loading when clicked.
Any suggested tips?
You might consider having that tab simply display a UIWebView with the web site.
I second glorifiedHacker in that having a tab bar item quit the application and launch another is not expected behavior.
My idea is, if you do not allow the users to customize the tab bar items, "Safari Launch" being pushed to "More" will never happen. You can prevent editing by setting the customizableViewControllers of your tab bar to nil or an empty array.