Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How do you set a navigation bar with a title in a popover controller? I want a detailed explanation, please help me.
Thanks in advance.
SomeViewController *popContentViewController = [[SomeViewController alloc] initWithNibName:#"SomeViewController" bundle:nil];
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:popContentViewController];
UIPopoverController popOverController = [[UIPopoverController alloc] initWithContentViewController:controller];
popOverController.delegate = self;
[popContentViewController release];
[controller release];
And in SomeViewController Class in viewDidLoad method write
self.title = #"Text For Title on Navigation Bar";
Related
This question already has an answer here:
New Xcode version 11.2.1 build app layout problem [duplicate]
(1 answer)
Closed 3 years ago.
View Controller status bar is overlapping in new iPhone like ios 8 When it's redirecting to another view controller , existing view screen status bar is displaying partially. I am using this code to redirect
SecondView *view = [[SecondView alloc] initWithNibName:nil bundle:nil];
[self presentViewController:view animated:YES completion:NULL];
This is not bug of status bar, this is feature of iOS 13, If you don't want this than you can set modalPresentationStyle to fullscreen. Like,
SecondView *view = [[SecondView alloc] initWithNibName:nil bundle:nil];
view.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:view animated:YES completion:NULL];
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
i try this code but it didn't work for me.
Thank You
-(void)passvar:(NSString *)user
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
UIViewController *viewController = (UIViewController *)[storyboard instantiateViewControllerWithIdentifier:#"signupvc"];
viewController.user = user;
[self presentViewController:viewController animated:YES completion:nil];
}
UIViewController does not have an user property.
You should use your custom subclass instead of UIVIewController
-(void)passvar:(NSString *)user
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"Main" bundle:nil];
MyCustomViewController *viewController = (MyCustomViewController *)[storyboard instantiateViewControllerWithIdentifier:#"signupvc"];
viewController.user = user;
[self presentViewController:viewController animated:YES completion:nil];
}
Note that in this code, you instantiate a new MyCustomViewController from the storyboard and present it to the user. It has nothing to do with any other View Controller that you opened before calling those line of code.
If you call this function 3 times, it will open 3 different MyCustomViewController.
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I've got an iOS app that is doing some crazy stuff... I'll do my best to describe it.
My navigation architecture is as follows:
AppDelegate calls this:
tabNavController = [[MainTabViewController alloc] initWithNibName:nil bundle:nil];
self.window.rootViewController = tabNavController;
[self.window makeKeyAndVisible];
MainTabViewController inherits from UITabBarController
Inside MainTabViewController's viewDidLoad, I programmatically load my tabs into an NSMutableArray and assign it to the tabControllers:
NSMutableArray *tabs;
StreamViewController *controller = [StreamViewController alloc] initWithNib...];
UINavigationController *navCon = [UINavigationController alloc] initWithRootViewController:controller];
[tabs addObject:navContorller];
...
self.viewControllers = tabs;
My very first tab -- the one that is displayed by default -- inherits from UIViewController. I have a UITableView setup in a XIB as the main view. My class is the UITableViewDelegate and UITableViewDataSource.
StreamViewController : BaseModuleViewController <UITableViewDelegate, UITableViewDataSource>
The table loads and displays fine. When a user clicks a row, I push a new view controller to the stack:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
...
DetailViewController* detailController = [[DetailViewController alloc] initWithNibName:#"DetailViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:detailController animated:YES];
...
}
This is where it gets strange. The view controller acts like its going to display, but it doesn't. I see my navigationBar animate -- my buttons shift around, the title changes, and a Back button shows up -- but the view itself does not display. I can even continue to click the table view cells and continually load more and more views, each new one animates the navbar and shows a new back button. I can then hit back X number of times to get "back" to my StreamViewController.
Here's the next kicker. If I navigate to tab #2, then back to tab #1, none of the above happens and the view appears exactly like it should.
Strange - anyone seen this and have an idea of what's going on?
EDIT
Here's a YouTube video showing it not working: http://youtu.be/Shces88d6Go
Try to add a navigation controller as your root view controller.
tabNavController = [[MainTabViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:tabNavController];
self.window.rootViewController = navCtrl;
[self.window makeKeyAndVisible];
Found that I was launching a modal window in the viewDidLoad method of my MainTabViewController. This somehow confused the system and was the root of the problem.
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Is it possible to change the title of PKAddPassesViewController ?
Hello, when I add a passbook I used coupon style:
pass = [[PKPass alloc] initWithData:data error:&error];
PKAddPassesViewController *vc = [[PKAddPassesViewController alloc] initWithPass:pass];
[vc setDelegate:(id)self];
[self presentViewController:vc animated:YES completion:nil];
the UIBarButtonItem have three button:“Cancel” ,“Coupon” “Add”
the “Coupon” is default, because I used coupon style, and I want to modify it.
I used vc.title=#"new Title" but this does not work.
No, it is not possible to modify the title text.
See this question Is it possible to change the title of PKAddPassesViewController ?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to develop a popover in my iPad application. A UIButton trigger will call the popover and that popover will contain a UITableViewController.
First I need a popover.
Need some example code or direction or link.
Thanks in advance.
in your viewcontroller on the button action write this code:
- (IBAction)openAllRhymes:(id)sender{
UIButton *button = (UIButton*)sender;
PopupTableView *tableViewController = [[PopupTableView alloc] initWithStyle:UITableViewStylePlain];
popover = [[UIPopoverController alloc] initWithContentViewController:tableViewController];
[popover presentPopoverFromRect:CGRectMake(button.frame.size.width / 2, button.frame.size.height / 1, 1, 1) inView:button permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[tableViewController release];
}
Now you have created a tableview for popover in that tableviewcontroller write:
self.clearsSelectionOnViewWillAppear = NO;
self.contentSizeForViewInPopover = CGSizeMake(108,400);
Read the documentation, it's all in there. If you don't understand it, start with general tutorials on iOS development or ask specifically about the parts you don't understand. You will need a solid understanding of how view controllers work before it makes sense to work with popovers. The View Controller Programming Guide also has a section specifically about popovers.
TAableViewController *tableViewController = [[[TAableViewController alloc] initWithNibName:#"TAableViewController" bundle:[NSBundle mainBundle]] autorelease];
UINavigationController *nav = [[UINavigationController alloc]
initWithRootViewController:tableViewController];
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:nav];
[nav release];
popover.delegate = self;
popover.popoverContentSize = CGSizeMake(320, 497);
[popover presentPopoverFromRect:button.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Here in this :-
1) TAbleViewController has the table you want to load .
2) i am adding this to the navigation controller
3) navigation controller to the popover