viewcontroller

Passing array between view controllers?

大兔子大兔子 提交于 2019-11-28 11:51:19
I really need some more help! I am trying to pass an array from one view controller to another. I think the latter being a 'child' view controller? My code is as follows: MainViewController.h: #import <UIKit/UIKit.h> #import <AudioToolbox/AudioToolbox.h> #import <AVFoundation/AVFoundation.h> @interface HelloWorldIOS4ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate, AVAudioPlayerDelegate> { NSMutableArray *countProductCode; UIPopoverController *detailViewPopover; } @property (nonatomic, retain) NSMutableArray *countProductCode; @property

Return to root view in IOS

假装没事ソ 提交于 2019-11-28 08:44:59
问题 To some this may sound like a daft question. I've searched around, and found little, mostly because I cannot find the appropriate search terms. Here what I want to do is: The application begins at view A. View A launches view B, and view B launches view C. Is their a way for view C to return directly back to A without dismissing itself and thus exposing B. For example a main menu button. 回答1: You can call popToRootViewControllerAnimated: if you have a UINavigationController. If you specify NO

Adding swift file to new view controller in xCode? (easy)

狂风中的少年 提交于 2019-11-28 06:18:57
I'm just starting out in xCode 6, and I can't seem to figure out how to add a new swift-file to the new view controllers I add in the interface builder. Any tips on how to proceed would be appreciated. Add a new Cocoa Touch class. Choose File->New->File... from the menu. Give this new class a name such as "ViewController2" and set the Subclass of: pop down to UIViewController . The file "ViewController2.swift" will be created. Click on your new View Controller in Interface Builder. In the Identity Inspector (on the right in Xcode) set the Custom Class for the View Controller to

Disable rotation for View Controller in Navigation Controller

一世执手 提交于 2019-11-28 04:21:48
问题 First of all, this isn't a duplicate. I've looked at all of the questions related to this on SO and none of them work for me. Hopefully it's just because I'm new to iOS development but I suspect this isn't possible in my case. I've attached a picture with the view controller circled that I want to disable rotation for. I've already tried: Subclassing the view controller that I want to disable rotation for and using the shouldAutoRotate method by setting it to NO. Apparently this doesn't work

Pass Variables to a new View Controller via a Subclass and Dozens of Map Pins

懵懂的女人 提交于 2019-11-28 02:23:06
I have a few moving parts in this one that I can't seem to stitch together, hopefully it is pretty straightforward. Previous questions don't use a subclass and in this example there could be dozens of custom pins on the map and each pin passes specific variables to a new ViewController Three Goals: Add image to custom annotation (see code below) I have a subclass named Capital , I would like to add the image in #1 and then create additional variables to hold values that will be passed to a new SecondViewController that includes (2) labels and a Picker View: for example label1 = "text1", label2

iOS - Linking framework storyboard to ViewController for use in main project

江枫思渺然 提交于 2019-11-28 00:20:44
I am attempting to pull through and use a storyboard in my main project which is being created in a framework. This is to use the framework in a multitude of different projects going forward. I have managed, using a bundle, to feed the storyboard through to the main project and I can see it when I build the app. However the appending ViewController, also sitting within the framework, does not link during runtime. All the classes in the framework are being imported to the main project. The error message says that it cannot find the view controller. I have attempted adding the view controller to

How can I remove a view from navigation controller

℡╲_俬逩灬. 提交于 2019-11-27 21:03:12
问题 I want to call a new view controller and remove the current view controller from the navigation controller stack. For example. I am in view controller A and I call B. Now I have in the stack A , B. Now I want to call C (from B). I want the stack to be A, C. Thanks. 回答1: In the context of ARC, here's a possible solution: NSMutableArray* navArray = [[NSMutableArray alloc] initWithArray:self.navigationController.viewControllers]; [navArray replaceObjectAtIndex:[navArray count]-1 withObject

UIScrollView prevents touchesBegan, touchesMoved, touchesEnded on view controller

主宰稳场 提交于 2019-11-27 19:43:24
I am handling touches for a couple of my UI components in my view controller (custom subclass of UIViewController). It has methods touchesBegan:withEvent: , touchesMoved:withEvent: , and touchesEnded:withEvent: . It was working fine. Then I added a scroll view (UIScrollView) as the top view in the hierarchy. Now my touch handlers on the view controller don't work. They don't get called. The interesting thing is, I have various other UI components within the scroll view that do work. Some are buttons, some are custom views that define their own touchesBegan:withEvent: , etc. The only thing that

Hide/Show iAds in Spritekit

给你一囗甜甜゛ 提交于 2019-11-27 18:38:02
问题 I've been trying to figure out how to hide and show iAds in my Spritekit Scenes. Currently I have it setup like this: ViewController.h #import <UIKit/UIKit.h> #import <SpriteKit/SpriteKit.h> #import <iAd/iAD.h> @interface ViewController : UIViewController <ADBannerViewDelegate> { ADBannerView *adView; } -(void)showsBanner; -(void)hidesBanner; @end ViewController.m #import "ViewController.h" #import <UIKit/UIKit.h> #import <iAd/iAD.h> #import "MyScene.h" #import <SpriteKit/SpriteKit.h>

Dismiss more than one view controller simultaneously

我怕爱的太早我们不能终老 提交于 2019-11-27 18:21:37
I'm making a game using SpriteKit. I have 3 viewControllers: selecting level vc, game vc, and win vc. After the game is over, I want to show the win vc, then if I press OK button on the win vc, I want to dismiss the win vc AND the game vc (pop two view controllers out of the stack). But I don't know how to do it because if I call self.dismissViewControllerAnimated(true, completion: {}) the win vc (top of the stack) is dismissed, so I don't know where to call it again to dismiss the game vc. Is there any way I can fix this without using navigation controller? This is the 1st VC: (Please pay