viewcontroller

Force landscape for one view controller ios

被刻印的时光 ゝ 提交于 2019-11-27 07:39:27
问题 I've looked at several answers to questions similar but none of the answer worked. I have an app where I need everything portait except for one photo viewer I have. In the supported orientations section of the targets menu I only have portrait. How do I force my one view to be landscape. It is being pushed onto the stack from a nav controller but I'm using storyboards to control all that. 回答1: Since the answer seems to be hidden in the comments of the question and since ArunMak's answer is

how to reload tableview of another uiviewcontroller in current viewcontroller

眉间皱痕 提交于 2019-11-27 06:20:38
问题 Please help me out. I am very sorry if it is duplicate but i didn't get required answer that is why i am asking again. I want to reload table of anotherview in my first view. Thanks in adavance. 回答1: In the first viewcontroller.m, I put this in the viewDidLoad method: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handle_data) name:@"reload_data" object:nil]; -(void)handle_data { [yourtableview reloaddata]; } In the second viewcontroller.m: [[NSNotificationCenter

Presenting modal in iOS 13 fullscreen

懵懂的女人 提交于 2019-11-27 05:15:35
In iOS 13 Beta 1 there is a new behaviour for modal view controller when being presented. Now it's not fullscreen by default and when I try to slide down, the app just dismiss the View Controller automatically. How can I prevent this behaviour and get back to the old good fullscreen modal vc? Thanks pascalbros With iOS 13, as stated in the Platforms State of the Union during the WWDC 2019, Apple introduced a new default card presentation. In order to force the fullscreen you have to specify it explicitly with: let vc = UIViewController() vc.modalPresentationStyle = .fullScreen self.present(vc,

Create singleton of a viewcontroller in swift 3

↘锁芯ラ 提交于 2019-11-27 04:28:55
问题 I know how to create singleton class in swift. The best and easy way to create singleton class is the following: class Singleton { static let sharedInstance = Singleton() } But I don't need singleton for any normal class. I need to create singleton for a viewcontroller class. So I'm using this code create singleton class AViewController:UIViewController { static let sharedInstance = AViewController() required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } } it gives me error

Swift programmatically navigate to another view controller/scene

谁说胖子不能爱 提交于 2019-11-27 02:52:26
I'm using following code to programmatically navigate to another ViewController. It works fine, but it some how hides the navigation bar . How do I fix this? (the navigation bar is created by embeding the ViewController in the navigation controller if that matters.) let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil) let nextViewController = storyBoard.instantiateViewControllerWithIdentifier("nextView") as NextViewController self.presentViewController(nextViewController, animated:true, completion:nil) In Swift 3 With a programmatically created Controller If you want to

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

こ雲淡風輕ζ 提交于 2019-11-27 01:16:18
问题 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. 回答1: 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

Open Specific View when Opening App from Notification

爱⌒轻易说出口 提交于 2019-11-26 22:34:36
问题 I have just added push notifications to my app. I'm wanting to have so that when a user opens the app from a notification, it will open a specific view controller and not my rootViewController. Here is my AppDelegate: #import "KFBAppDelegate.h" #import "KFBViewController.h" #import "AboutUs.h" #import "ContactUs.h" #import "KYFB.h" #import "KFBNavControllerViewController.h" #import "KFBTabBarViewController.h" #import "RSFM.h" #import "LegislatorInfo.h" #import "Events.h" #import

Sending data from one ViewController to another.

痴心易碎 提交于 2019-11-26 22:09:09
问题 I have got two ViewController: 1) ViewController 2) TestAppViewController In ViewController.h , I define a label, whose text I want to be sent from second viewController, i.e `TestAppViewController. For this I defined a @property NSString * in ViewController.h , and created an object of this ViewController in my second Controller. Then passed a value to this property, but ans is still coming nil. Following is my code : @property (nonatomic, retain) NSString *lableName;* ViewController #import

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

房东的猫 提交于 2019-11-26 21:41:02
问题 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

In iOS, how to drag down to dismiss a modal?

僤鯓⒐⒋嵵緔 提交于 2019-11-26 21:09:37
A common way to dismiss a modal is to swipe down - How do we allows the user to drag the modal down, if it's far enough, the modal's dismissed, otherwise it animates back to the original position? For example, we can find this used on the Twitter app's photo views, or Snapchat's "discover" mode. Similar threads point out that we can use a UISwipeGestureRecognizer and [self dismissViewControllerAnimated...] to dismiss a modal VC when a user swipes down. But this only handles a single swipe, not letting the user drag the modal around. Robert Chen I just created a tutorial for interactively