uiviewcontroller

Property not initialized at super.init call

 ̄綄美尐妖づ 提交于 2019-12-23 05:22:52
问题 I have the following init method in my view controller: init(mainViewController: UIViewController, settingsViewController: UIViewController, gap: Int) { self.mainViewController = mainViewController self.settingsViewController = settingsViewController self.gap = gap self.setupScrollView() // I get error here super.init(nibName: nil, bundle: nil) //and here. } The self.setupScrollView method for now just looks like this: func setupScrollView() { self.scrollView = UIScrollView(frame: CGRectZero)

change return from shouldAutorotateToInterfaceOrientation: at runTime

╄→尐↘猪︶ㄣ 提交于 2019-12-23 05:19:08
问题 I'm using shouldAutorotateToInterfaceOrientation: for respond YES to all orientations. At runtime, in few case, i must change the return to YES only in portrait. But if i change this return type, and my device not physicly turn, my interface orientation not change. How can it's possible to force uiView to check the shouldAutorotateToInterfaceOrientation: and rotate the view without UIdevice rotation notification. Thanks a lot. 回答1: Add this two lines of code: [[UIDevice currentDevice]

Change BackBarButtonItem for All UIViewControllers?

守給你的承諾、 提交于 2019-12-23 05:16:14
问题 I would like to change the BackBarButtonItem on all the views in my iOS app so that they show just the back arrow with no text. Is the only way to accomplish this is to go through every UIViewController and set the self.navigationItem.backBarButtonItem.title ? Seems I should be able to create a superclass to define the default value of backBarButtonItem.title , but I am not sure where to start. Thank you for your help. 回答1: You don't need to change it on every view controller class. You can

Pass NSMutableArray between two UIViewController's

被刻印的时光 ゝ 提交于 2019-12-23 05:15:26
问题 I have two view controllers name RootViewController and SecondViewController. In the FirstViewController I have this NSMutableArray @interface RootViewController : UITableViewController { NSMutableArray *allClasses;}@property (nonatomic,retain) NSMutableArray *allClasses; In the RootViewController I populate the UITableView with all the objects within allClasses In my SecondViewController I have @interface SecondViewController : UIViewController <UITextFieldDelegate,UIPickerViewDelegate> {

Change a UILabel's text from another class

血红的双手。 提交于 2019-12-23 05:04:37
问题 I have a view controller and a class (I am using storyboards). How can I change the text of a UILabel (in the view controller) from the class? I have tried this, but to no avail: ViewController *mainView = [[ViewController alloc] init]; [mainView view]; [mainView.progressBar setProgress:integer animated:YES]; NSLog(@"Updated Progress Bar"); NSString *progressLabelText = [NSString stringWithFormat:@"%@ out of %i followers", userString, [self.followers count]]; [mainView.progressLabel setText

Switch between different Views in SWIFT

丶灬走出姿态 提交于 2019-12-23 04:50:26
问题 I read a lot of questions / answers in the stack overflow community about switching between different ViewControllers but I couldn't find the correct answer for my specific problem. I'm using a NavigationViewController to "connect" all my different viewControllers (ViewController / TableViewController / CollectionViewController) I have got some classes which aren't depending on a ViewController class. For example to to calculate anything in my "calculate" class. I'm searching for an easy

How do i create an accordion control similar to one created using AJAX in IOS?

岁酱吖の 提交于 2019-12-23 04:48:11
问题 I want create an accordion control similar to one created using AJAX http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Accordion/Accordion.aspx where I can place icons instead of text for iPhone. 回答1: Basically you want to use an expandable UITableView - when you tap a cell you reveal a number of cells beneath it (the contents of your accordion). You don't necessarily need to use a table view, but typically it's a good starting point. There are a couple of controllers that have been

Architecture of view hierarchy - iPhone

感情迁移 提交于 2019-12-23 04:35:23
问题 I am making a multiplayer game. My First screen , should show a login form (not modally). When it finishes, it should call a delegate to my "root class" and the "root class" should remove this view controller and add another.Then when the game ends the "root class" will be called with another delegate method and it should show another screen etc.. I have 3 ideas about it and I would like to know which is going to work better. a) My root class is a uiviewcontroller and it adds/removes subviews

Passing an image when taped on uicollectionview to a detail view controller in swift

北慕城南 提交于 2019-12-23 03:51:56
问题 Ive been at this for a while but cant seem to crack it in swift I want a user to be able to select an image in uicollectionView and for that image to appear in a detailed view controller, i can do this quite easily with a peice of text, and i can do this when there is a static array of images preloaded. but i cant seem to get anywhere with a collectionview which is loaded with images from a camera. I understand i need to use override func performSegueWithIdentifier(identifier: String, sender:

Clarifications on managing orientations in UIViewController

≯℡__Kan透↙ 提交于 2019-12-23 03:32:11
问题 I have a configuration like the following: UINavigationController -> ViewController where ViewController is the root view controller for the navigation controller. ViewController can present modally another view controller, ModalViewController , like the following. self.presentViewController(modalViewController, animated: true, completion: nil) Within ModalViewController I override the following method. The modal view controller in fact can be presented only in Landscape mode. override func