uiviewcontroller

Restart iphone application from the very beginning

风流意气都作罢 提交于 2020-01-02 11:07:09
问题 when i close my application (via HOME button) and open it up again, how do i force the application to restart from the very beginning view and not from the last location that was shown (before it was closed)? is it a setting in the project? 回答1: Set the app's info.plist key: UIApplicationExitsOnSuspend to True. 回答2: Look for a notification from the phone letting you know that the phone "Became Active" which will only happen if the app was running, then sent to background, then pulled up again

Restart iphone application from the very beginning

醉酒当歌 提交于 2020-01-02 11:06:29
问题 when i close my application (via HOME button) and open it up again, how do i force the application to restart from the very beginning view and not from the last location that was shown (before it was closed)? is it a setting in the project? 回答1: Set the app's info.plist key: UIApplicationExitsOnSuspend to True. 回答2: Look for a notification from the phone letting you know that the phone "Became Active" which will only happen if the app was running, then sent to background, then pulled up again

ViewController addSubview

痞子三分冷 提交于 2020-01-02 10:29:22
问题 I am nearly going crazy: GolOlurActionViewController *golOlur = [[GolOlurActionViewController alloc] init]; [self.view addSubview:golOlur.view]; I have the above code, and I call this in an IBACtion inside a ViewController . GolOlurActionViewController is a ViewController as you all can guess. When the process starts, golOlur's viewDidLoad and viewDidAppear methods are called but the view is not presented. I have tried everything I know but could not solve this. 回答1: You really should not use

Why does my UITableView's formatting go completely awry when I return from a view controller I segued to?

时光总嘲笑我的痴心妄想 提交于 2020-01-02 08:13:08
问题 I have a UITableView with a custom cell, which has a few labels in it that dynamically decide the height of the cell. When I tap on one cell and segue to a new view controller, upon returning all the formatting for the cells is completely messed up, and I can't figure out what is causing it. Here is what the cells normally look like: And I have some pretty basic constraints set on them. The top label is pinned to the top and left margins, and must always be >= 20 from the right. The other

How to call a function in the first controller after dismissing the second controller

ぃ、小莉子 提交于 2020-01-02 06:09:52
问题 I have two UIViewController, when I click a button, it goes from the first view controller to the second one. And before that, I animated a UIView to move to another place. After dismissing the second View Controller, I want to move the UIView in the first view controller back to where it originally was. However, when I call a function from the second View Controller to animate the UIview in the first view controller after dismissing the second one, It could not get the UIView's properties,

Reusing UIViewController for modal and non-modal situations

廉价感情. 提交于 2020-01-02 04:45:07
问题 I have a UIViewController — let's call it "FormController" — which is simply a form that edits an object. I want to use it in 2 different situations: Creating a new object — using using UINavigationController's presentModalViewController: method. Editing an existing object — push the view controller onto the UINavigationController stack, not using a dialog method. There is a slight difference in that in the modal situation I would like to have a toolbar with "Cancel" and "Done" buttons,

UIViewController init vs initWithNibName:bundle:

佐手、 提交于 2020-01-02 04:37:13
问题 In my app I am pushing a view controller (a UITableViewController) that has also a property/outlet referencing a UITableViewCell. It appears that creating the controller with: PreferencesController *pController = [[PreferencesController alloc] init]; doesn't create the object for the UITableViewCell in the xib file, thus the outlet is null, thus the table loading generates an exception. I solved this with: PreferencesController *pController = [[PreferencesController alloc] initWithNibName:@

Images not all showing up on simulator but shows in storyboard

不羁岁月 提交于 2020-01-02 01:20:06
问题 I am pretty new to iOS development and I was poking around in storyboard in Xcode 4.5.2. I started a new tab bar project (5 tabs) and then dropped in some images (UIImageViews objects) to them, everything looked good and the build came out fine on the simulator but not all the images are showing up. The same image would be showing on the Firstviewcontroller but it won't show on another viewcontroller. And I can't seem to add new image objects into the firstone (meaning i can place it in the

Load view from NIB file from several different UIViewControllers

家住魔仙堡 提交于 2020-01-01 20:03:43
问题 I have been loading view from Nib files successfully using the approach found on this site [[NSBundle mainBundle] loadNibNamed:@"YourNibName" owner:self options:nil]; The problem is that, because we have to set the File Owner, this nib file becomes "attached" to this view controller. This view is subclass of UITableViewCell and I wanted to load this nib file from several different vc's. Thanks for your help. 回答1: I'll present two options: Create a class NibLoader with a single @property

How to properly create a root view controller?

荒凉一梦 提交于 2020-01-01 19:41:08
问题 After upgrading to xCode 4.2 I am getting the following warning... Applications are expected to have a root view controller at the end of application launch After reading as much as I could find on line about the RootViewController I am not sure whether I have created my root view controller properly. I created it a long time ago when I was first learning to program in xCode. One question I have is it ok to name the root view controller something other than RootViewController. Every example I