uiviewcontroller

viewDidAppear & viewWillAppear not firing in tabbar app

喜夏-厌秋 提交于 2019-12-25 00:39:21
问题 In a tab bar application, I'm adding a view to my first tabbar view by doing: [self.view addSubview:anotherView.view]; Once anotherView is done, I do: [self.view removeFromSuperview]; Which goes back to the parent but doesn't fire viewDidAppear or viewWillAppear on the parent. I can use messaging but it seems there must be a better way. Any suggestions? 回答1: When you add a subview to the first view, it's still visible, just behind the second view. Those methods don't fire because technically

How to access one UIViewControllers properties from another UIViewController?

爷,独闯天下 提交于 2019-12-25 00:33:25
问题 I have one single MainViewController which has of course it's one main UIView. I have this main view comprised of many different subviews. Some of these subviews have their very own ViewController. Lets say the MAIN view (whose delegate is primarily MainViewController) has a container which loads another UIView that uses a separate UIViewController- SecondaryViewController as the delegate for most it's actions. This container view is of course loaded in MainViewController via

How To Navigate Objective-C App Programmatically Without Using Only Storyboard?

自古美人都是妖i 提交于 2019-12-25 00:24:23
问题 I am having trouble navigating my application. I have written a game scene completely in Sprite Kit (all buttons, etc. using SKNodes) with Objective-C. When the user opens the app, it presents a main menu which is built completely in Storyboard and contains a UIButton that triggers a transition to the ViewController with my game scene in it. Originally, to restart the game once the user lost I just presented a new scene like this: GameScene *newScene = [GameScene sceneWithSize:self.view

How to dismiss a collection of UIViewController objects that were loaded dynamically in Xcode 4

99封情书 提交于 2019-12-25 00:01:30
问题 I am having some trouble with dismissing a collection of UIViewController objects. I do not know of an elegant way to dismiss all loaded modal UIViewController objects at once. I make use of the "storyboard" in Xcode 4, but I do not use Segues to map the screens. I use dynamic code, like so: It all starts in MainViewController.m. I load [myMenuController] (a menu list). When the user selects an option from the menu, it then loads [myTicketController]. After some user interaction there, it

How to remedy a UINavigationBar overlapping the top of my UIScrollView?

こ雲淡風輕ζ 提交于 2019-12-24 23:26:59
问题 I am working with a TabBarController >> NavBarController UI. One of my UIViewControllers has a UIScrollView in it with some text (UITextField) in it. Problem is, the uppermost text in the UIScrollView is covered by the NavBar. How do I fix this? I am trying to manually adjust stuff in IB with mixed results but I want a more CERTAIN solution. 回答1: The problem is that your view is too big, and it's being positioned under the nav bar. To fix, open up the .xib with your container view and/or your

passed object nil into my second view

∥☆過路亽.° 提交于 2019-12-24 23:24:30
问题 I have a CalendarView and I've passed the object to another UIView with a tableView in it. In my CalendarView: anotherView *anotherViewController = [[anotherView alloc] init]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"dd-MM-yyyy"]; NSString *dateString = [formatter stringFromDate:aDateObject]; anotherViewController.eventDate = aDateObject; anotherViewController.eventDateTitle = dateString; [formatter release]; [anotherViewController release]; I

UINavigationBar back button disappears

…衆ロ難τιáo~ 提交于 2019-12-24 21:51:06
问题 I have lost a lot of time with this weird error/bug. I have 2 ViewControllers with navigationController and I move from the first to the second with pushViewController. But when I push second viewController, it shows up and also backButton on the navigation bar shows up. But this button disappear in a very short time (about half a second). Title of the first viewC is ok and it`s also on the back button (I can catch it in the time it is shown up). Does anyone have a tip where could be the

Modal View Controllers - UIBarButtonItems Do Not Persist

一世执手 提交于 2019-12-24 20:32:39
问题 I present modal view controllers, packaged in a UINavigationController. When they first appear, the bar button items are alright. However, if I click a button and a new view controller is pushed to the UINavigationController, and then I use the back button of that view controller, and it gets popped back to the original modal view controller , the buttons do not show up , (but they work when I click them -> just can't see them) I can't seem to figure out why this occurs. Here's some code. Oh,

TouchesMoved method for two view controllers

丶灬走出姿态 提交于 2019-12-24 20:23:10
问题 In my app there are two view controllers. I wrote touchesmoved method in both the view controllers. But even if i touch on second view controller on simulator, the first VC touches moved method is called. // for VCOne -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"first view vc move method"); UIStoryboard *storyboard = self.storyboard; ThreadedView *secViewController = [storyboard instantiateViewControllerWithIdentifier:@"threaded"]; [self.view addSubview

UIViewController initWithNibName results in nil view

帅比萌擦擦* 提交于 2019-12-24 20:20:48
问题 I'm trying to make a view controller that will always load the same nib. My initialization code looks like this: -(id)init { NSString* nibName; if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) nibName = @"XIB_iPad"; else nibName = @"XIB_iPhone"; self = [super initWithNibName:nibName bundle:nil]; if (self) { ... } return self; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { return [self init]; } The problem is that this code results in the view