uiviewcontroller

Why UIBarButtonItem doesn't call IBAction before segue?

萝らか妹 提交于 2021-02-08 10:35:47
问题 My question is very similar to : Swift: Make button trigger segue to new scene The issue is: I have a view controller, with a button that causes another view controller to appear modally. I have Ctrl+Click from the button to the second View Controller, and created the segue in IB. Then I Ctrl+Click from the button again to the source code of the view controller to create an IBAction method. I assumed that the button will do two things now: a) call the IBAction method , and b) perform the

Why UIBarButtonItem doesn't call IBAction before segue?

有些话、适合烂在心里 提交于 2021-02-08 10:34:03
问题 My question is very similar to : Swift: Make button trigger segue to new scene The issue is: I have a view controller, with a button that causes another view controller to appear modally. I have Ctrl+Click from the button to the second View Controller, and created the segue in IB. Then I Ctrl+Click from the button again to the source code of the view controller to create an IBAction method. I assumed that the button will do two things now: a) call the IBAction method , and b) perform the

Get all list of UIViewControllers in iOS Swift

爷,独闯天下 提交于 2021-02-07 06:44:06
问题 Is there any way to fetch all UIViewControllers in iOS Swift Project. I want to get array of all the UIViewControllers and check whether particular UIViewController exists or not.I have to just find the particular UIViewController exists or not in project. 回答1: You can do it with below code. let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate if let viewControllers = appDelegate.window?.rootViewController?.presentedViewController { // Array of all viewcontroller even

Call a method from AppDelegate - Objective-C

二次信任 提交于 2021-02-07 05:16:32
问题 I was trying to call an existing method of my ViewController.m from AppDelegate.m inside the applicationDidEnterBackground method, so I found this link: Calling UIViewController method from app delegate, which told me to implement this code: In my ViewController.m -(void)viewDidLoad { [super viewDidLoad]; AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; appDelegate.myViewController = self; } In my AppDelegate: @class MyViewController; @interface AppDelegate :

View Controller Transition animate subview position

喜你入骨 提交于 2021-02-06 11:56:27
问题 I'm trying to create a simple transition animation between two view controllers, both of which have the same label. I simply want to animate the label from its position in the first view controller, to its position in the second (see below illustration). I have set up my view controllers to use a custom animation controller, where I have access to both view controllers and the label through an outlet. In the animation block, I simply set the frame of the label on the first view controller to

Using definesPresentationContext with UIModalPresentationStyle.custom

放肆的年华 提交于 2021-02-06 10:46:06
问题 I am using view controller containment to manage a set of child view controllers which should be able to modally present other view controllers in a custom manner. I have run into an issue where the definesPresentationContext property is not used when a presenting from a view controller using UIModalPresentationStyle.custom As an example, I have three view controllers: ROOT , A , and B ROOT |_ A A is the child of ROOT . I would like to present B modally from A while using custom

UITableViewController vs UIViewController

送分小仙女□ 提交于 2021-02-05 21:51:43
问题 What all does UITableViewController get me that makes it actually useful? Is there any bonus is using it instead of just using a UIViewController for views with UITableViews in them? I ask because I want my views with UITableViews to inherit from a base view controller (which inherits from UIViewController ). If I use a UITableViewController then having a base class for all my views becomes more difficult. 回答1: Not much. It provides some conveniences, but you never really need it; I often don

UITableViewController vs UIViewController

只谈情不闲聊 提交于 2021-02-05 21:40:02
问题 What all does UITableViewController get me that makes it actually useful? Is there any bonus is using it instead of just using a UIViewController for views with UITableViews in them? I ask because I want my views with UITableViews to inherit from a base view controller (which inherits from UIViewController ). If I use a UITableViewController then having a base class for all my views becomes more difficult. 回答1: Not much. It provides some conveniences, but you never really need it; I often don

Sending Data to UIViewController From UIView Subclass With Delegate

回眸只為那壹抹淺笑 提交于 2021-02-05 08:22:27
问题 I have an IBOutlet-connected UIView object (innerView) sitting over view controller ( UIViewController )'s view. I want to let the user rotate innerView with their finger. So I have a subclass (TouchView) of UIView set to innerView's class. As the user rotates the view object, I want the view controller to receive a value from TouchView. And what I have is the following. // UIView protocol TouchDelegate: class { func degreeChanged(degree: Double) } class TouchView: UIView { weak var delegate:

How to code for a specific view contoller? - Apple Swift/Xcode

心已入冬 提交于 2021-01-29 15:38:53
问题 I am trying to code a basic calculator for a specific view controller in my project, but I don't know the function to call my specific view controller. I expect to be able to connect my outlets, but I can tell that it has to be in the scope of a specific function. I am unable to connect an outlet from any view controller other than the root. I'm a student, and I've tried to look up function names for a specific ViewController, but I cannot find the right result. Thanks in advance! 回答1: first