pushviewcontroller

How can I show ViewController in UITabBarController?

徘徊边缘 提交于 2019-12-04 15:30:51
I have a UITabBarController and all my other view controllers are connected to it. Now I want to show one my controller as: let storyboard = UIStoryboard(name: "Main", bundle: nil) let vc: ViewController = storyboard.instantiateViewControllerWithIdentifier("ViewController") as! ViewController but when I tried to: let rootViewController = self.window?.rootViewController as! UINavigationController rootViewController.pushViewController(vc, animated: true) it gave me the next error: Could not cast value of type 'UITabBarController' (0x1a899b818) to 'UINavigationController' Later I've tried to do:

Programmatically add UINavigationController in UIViewController

╄→尐↘猪︶ㄣ 提交于 2019-12-04 08:41:21
问题 I currently have a view set up as the following: @interface BlogViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> { UITableView *mainTableView; } @property (nonatomic, retain) UITableView *mainTableView; As you can see, it has a UITableView inside of it that I load all of my data to. However, when I call the following function: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { SingleBlogViewController *viewController = [

What is the difference between addChildViewController and presentModelViewController

China☆狼群 提交于 2019-12-04 02:12:27
I know there are three ways to change the view in iOS 1. [self addChildViewController:thirdViewController]; [contentView addSubview:thirdViewController.view]; 2. First * sVC = [[First alloc] initWithNibName:@"First" bundle:[NSBundle mainBundle]]; [self presentModalViewController:sVC animated:YES]; 3. MyViewController *sampleViewController = [[[MyViewController alloc]initWithXXX] autorelease]; [self.navigationController pushViewController: sampleViewController animated:true]; pushViewController requires the navigation controller, which I understand. However, when to use addChildViewController

How return a value from view2 to view1 when using navigation bar

99封情书 提交于 2019-12-03 20:20:19
I am New to the iPhone Development. How can i carry a string value from view2 to view1 when using navigation bar. I have no problem in carrying string values from view1 to view2 to view3 to....by using pushviewcontroller But when i come back to previous views using Back button of navigation bar, I cannot able to hold string values. I need your help in solving this issue. Thanks In Advance This thing can be done easily if the pass the reference of the current class to the next class and change the values by using this reference. Like: The class that is to be pushed. @interface B

ios: how to dismiss a modal view controller and then pop a pushed view controller

[亡魂溺海] 提交于 2019-12-03 12:17:12
I have a view controller B that is pushed onto the navigation stack by root view controller A and this view controller B needs to display an alternative view if its model is in a certain state so it is modally presenting another view controller C. When I dismiss view controller C I would also like to pop view controller B if that is also on the nav stack. I would like to do it in such a way that there is only 1 transition. Any ideas? In the scenario you posted, the presenting view controller for view controller C will actually be the navigation controller, so you can ask it to pop off B, and

hide tab bar in view with push

五迷三道 提交于 2019-12-03 11:03:46
问题 I have a tabBar + NavigationViewController . The Tab bar has collection view with cells(Say view1 ) and with cells a push seague is implemented to another view(Say view2 ). In view2 I want to have a navBar but no tab bar. I tried self.tabBarController?.tabBar.hidden = true , it worked fine for view2 but when I went back to view1 by back button the tab was still hidden( even after in view1 class I added self.tabBarController?.tabBar.hidden = false in viewDidLoad func). How can i make the tab

Push and Pop behaviour is strange, why?

自作多情 提交于 2019-12-02 15:50:03
问题 I have two classes, the one is addAlarm and second is Name,,, for now I am in addAlarm (addAlarm is subclass of UITableViewController), as it selects the row, then it goes to Name class as below Name *ob = [[Name alloc] initWithStyle:UITableViewStyleGrouped]; [self.navigationController pushViewController:ob animated:YES]; [ob release]; ob = nil; then there is UINavigationBar with addAlarm as back button by default, while Name is also subclass of UITableViewController I observe that when I

Prevent UITabBar to hide when pushed

十年热恋 提交于 2019-12-02 08:43:35
First let me tell about my app scenario. UINavigationController {relationship} UIViewControllerMain {push} UITabController {push} UIViewControllerOne . Here problem is tab bar hides in UIViewControllerOne . How can i make it visible? self.tabBarController.tabBar.hidden = NO; 来源: https://stackoverflow.com/questions/12244816/prevent-uitabbar-to-hide-when-pushed

Push View Controller not showing elements added from storyboard

牧云@^-^@ 提交于 2019-12-02 01:33:00
Okay, so far I've two view controllers in my storyboard. One with "login" elements and other as "User's home" sort of thing. I am intending to do the following : When user clicks on login, there's a bit of processing and then it should show to user's home screen.. When I do it via storyboard, i mean = control drag "login" button to user's home view it works fine. But I cant use that as I've to process the login data. It also shows some animation meanwhile. So, I've to do this shift programmatically. I wrote following code in the login button's IBAction :: HomeViewController *homeView = [

Why can’t UIImagePickerController be pushed into navigation stack?

别等时光非礼了梦想. 提交于 2019-11-30 17:16:36
When using pushViewController to push UIImagePickerController : [self.navigationController pushViewController:pvc animated:YES]; an error will occur such as: Pushing a navigation controller is not supported The right solution is to use presentModalViewController : [self presentModalViewController:pvc animated:YES]; Can someone explain why this is necessary? What‘s hidden in UIViewController ? Thanks! Apple does not allow stacking of navigation bars. Since the image picker has its own navigation bar, it cannot be placed in a navigation stack. The result would cause user confusion since there