uiviewcontroller

Adding UIViewController.view to another view causes orientation problems

浪子不回头ぞ 提交于 2020-01-25 08:31:05
问题 Short version: I'm alloc/init/retaining a new UIViewController in one UIViewControllers viewDidLoad method, adding the new View to self.view. This usually works, but it seems to mess up orientation change handling of my iPad app. Longer version : I'm building a fairly complex iPad application, involving a lot of views and viewcontrollers. After running into some difficulties adjusting to the device orientation, I made a simple XCode project to figure out what the problem is. Firstly, I have

view controllers: presentation, dismissal

◇◆丶佛笑我妖孽 提交于 2020-01-25 00:34:25
问题 Just for the purpose of learning some particular aspects of xCode, I am creating a simple app that has 2 functional view controllers. Each contains a button that can be pressed to switch to the other. I am not using segues. I am using pointers retrieved from the app delegate. visual illustration (click for higher resolution): When the app loads, the root view controller presents view 1. When you click "switch to view 2," the following code causes view 2 to appear: - (IBAction)buttonPressed:

How to use one ContainerView to show multiple ViewControllers

自作多情 提交于 2020-01-24 21:33:26
问题 My scenario is that right now my app uses 12 ViewControllers. Each one has two ContainerViews which hold the same set of controls (I'll call them control groups) and I show them via segues. So far this is working however, I have to layout and set constraints for the same two ContainerViews 12 times - once for each VC. And if I add another VC, then I have to lay them out again, etc. If I change any part of my layout then I have to modify all 12 again and again - it's not really scalable. It

How to optimize performance in view controller navigation with UISegmentedControl and UITabBarController

 ̄綄美尐妖づ 提交于 2020-01-24 20:25:39
问题 On a project I'm working on, the design decision was to use a UISegmentControl at the top, with a UITabBarController on the bottom. The UISegmentControl has 3 choices for 3 different views. Currently, my coworker has added all 3 views to an NSArray when that particular tab is selected, and then based on the UISegmentControl, the view selected gets unhidden, and the other two are hidden. It seems to not follow Apple's guidelines of lazy loading and seems expensive since 3 viewDidLoads (where

isMovingToParentViewController always returning FALSE for root view controller of a navigation stack?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-23 14:20:31
问题 What is the proper method to determine whether the root view (top level) controller of a navigation stack is appearing as a result of being initially presented vs. being uncovered? The iOS documentation suggests using isMovingToParentViewController inside viewWill/DidAppear: to make that determination. This works for view controllers pushed on the stack, but appears to always return FALSE for the stack root view controller. Thanks for helping. 回答1: Looks like someone else has answered the

Popping multiple views from the navigation controller

对着背影说爱祢 提交于 2020-01-23 08:39:09
问题 I have an application which its rootview is a menu to 4 tableviews that the user uses to set up a search query by selecting a cell that loads another subview, so the basic structure looks like this Root View - Parent View (search view) --Sub View (user selects variables here to fill search parameters of the parent view But one of the Parent View search parameters requiers another sub view to be pushed onto the navigation stack so it would look like Root View - Parent View (search view) --Sub

Conditionally skipping a UIViewController in an iOS 5 app with UINavigatonController

半腔热情 提交于 2020-01-23 05:05:05
问题 In our iOS application with three UIViewController s one after another, we would like to skip the middle one based on some condition and go directly from first to third. However, the user should be able to come back to the second one via the "Back" button on the third controller. I tried [self performSegueWithIdentifier:@"segueId" sender:sender]; from viewDidLoad , viewWillAppear but this corrupts the navigation bar as indicated by the debug log. Calling this code from viewDidAppear works

What is the extend edge property in UIViewController for ?

守給你的承諾、 提交于 2020-01-22 20:03:05
问题 I have read on the forums about this property, mostly its people setting this this property to false or unchecking it in the storyboard. I have done this myself because when I have a UINavigation Controller embedded in a View, the top bar pushes my UITextView down so the text starts editing at the bottom. Unchecking Extended Edges Under Top Bars in the StoryBoard in the UIViewController solves my problem but I don't understand what is going on. Can someone give an explanation on what the

Launching ViewController from AppDelegate

倾然丶 夕夏残阳落幕 提交于 2020-01-22 05:50:12
问题 I have a custom URL scheme and i want to open a certain ViewController which is not the root when i go to this URL. I have been able to do that and what remains is pushing this ViewController into the navigationController from the AppDelegate where i handle my URL like this : - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { if ([[url scheme] isEqualToString:@"njoftime"]) { NSDictionary

Use NSNotificationCenter selector for one observer in multiple view controllers

隐身守侯 提交于 2020-01-22 02:08:51
问题 Can I use the selector getUpdate: in multiple view controllers? I'm registering my LevelViewController as an observer for both GameViewController and WinViewController . The latter 2 view controllers both have a back button (which, when pressed, pops you back to LevelVC ), and the idea with the notification is to tell LevelVC whether or not to update the collection view cells (via the viewWillAppear: method) when the back button is pressed. In viewWillAppear: , I wouldn't want to call two