FAQ Database Discussion Community


SWIFT pass value to another existed ViewController

ios,uitableview,swift,uiviewcontroller,uistoryboardsegue
I have 2 ViewControllers. First one connected with second with 'Show'. When I click 'Add' button on the first - second will appear. Then I need to click on the cell in tableView (in the 2nd VC) and pass it's value to the label of the first VC and segue...

Status bar sized incorrectly with a contained UINavigationController

ios,uiviewcontroller,uinavigationcontroller,statusbar
I make a UINavigationController a child of another view controller through containment. Everything works fine, except for a strange issue that occurs when launching the app with the in-call status bar turned ON and then switching it back OFF after the app UI is on the screen. There appears a...

Subclass as delegate of superclass

ios,objective-c,inheritance,uiviewcontroller,delegates
I have class ImageViewController. It has delegate: @protocol ImageViewControllerDelegate @optional - (void)singleTapGestureRecognizer:(UITapGestureRecognizer *)gesture; - (void)imageDidLoaded; I also have class AttachmentViewController that subclass of ImageViewController. In that class I want to get event then image property in changed. So here is my code of it change: - (void)setImage:(UIImage *)image { //...

Unwind Segue not being performed after shouldPerformSegueWithIdentifier UIAlertController

ios,iphone,swift,uiviewcontroller,uialertcontroller
I have an unwind segue from a UIViewController named DetailViewController to MainViewController defined as (within MainViewController): @IBAction func deleteItemUnwind(sender: UIStoryboardSegue) { let sourceViewController = sender.sourceViewController } In the DetailView, I have the button that should perform the segue connected to the scene exit with the name deleteItemUnwindSegue, and in DetailViewController...

calling dismissPopoverAnimated in viewWillDisappear crashes application

ios,objective-c,uiviewcontroller,uipopovercontroller
I have two ViewControllers. Let's call them no1 and no2. In no2 I have PopoverViewController with some options and instance of NSTimer. Timer function is calling popToViewController 3 seconds after popup is presented if nothing is clicked in the popover, which is returning user to no1 ViewController. Problem is when...

swift change uiviewcontroller's view

ios,swift,uiviewcontroller
I create a new UIViewController, I don't use storyboard, this is my code. I want to change my view frame, this not work for me, I had try to add on viewWillAppear, it's still not work, I know I can add a new UIView to do it. Can I change...

Custom transition iOS (Push/Pop)

ios,objective-c,animation,uiviewcontroller,custom-transition
I created a custom zoom-in transition when pushing a new viewController, and it used to work perfectly fine. Now I want to create a zoom-out effect when popping the viewController, and even-thought the final state is correct, the animation is wrong since I don't know how to identify if it...

Accessing Navigation Bar Height and Status Bar Height

ios,swift,uiview,uiviewcontroller
I am currently developing my first iOS application using Swift and I am running into a lot of issues with the UI portion of app development. I have decided to do all of the views programmatically because enough of them are complicated enough that I think storyboarding would be major...

Dismiss a Modal UINavigation Controller

ios,swift,uiviewcontroller,uinavigationcontroller,modalviewcontroller
I have a UIViewController (a) which is the root view controller in a UINavigationController (b). The UINavigationController is displayed modally (via a segue) from another UIViewController (c) that is completely separate. The issue I'm having is that when I try to dismiss the modally displayed vc (a) I get a...

Load a view that is previously loaded in iOS

ios,objective-c,uiviewcontroller,uinavigationcontroller,viewcontroller
I have been searching around about this problem, but haven't got any answer yet. My problem is: I have a push button that when clicked will push to another view. Here is how I push it: ViewController *vc = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"Main_View"]; [self.navigationController pushViewController:vc animated:YES]; The ViewController vc is...

View Controller lifecycle on UIModalPresentationOverCurrentContext

ios,uiviewcontroller
How do I determine when the parent view controller has been hidden or shown when I use the UIModalPresentationOverCurrentContext modal presentation style? On normal situations I can use the viewWillAppear: and viewWillDisappear:, but they seem not to be firing on this.

UIWebView path depends on previous pressed button Xcode

ios,objective-c,iphone,xcode,uiviewcontroller
I have a ViewController (A), containing n buttons. all buttons map to other ViewController(B) containing a WebView to show a different PDF. Instead of creating n ViewController, I would know how to change path according to which button was pressed. my wrong tries: 1- use tags of buttons in ClassB...

why is my app stalling when the play button is tapped

ios,swift,uiviewcontroller,uibutton,xcode6
import UIKit class ViewController: UIViewController { var timerCount = 5 var timerRunning = false var timer = NSTimer() func shuffle<C: MutableCollectionType where C.Index == Int>(var list: C) -> C { let c = count(list) for i in 0..<(c - 1) { let j = Int(arc4random_uniform(UInt32(c - i))) + i swap(&list[i],...

How can I modally present a UIViewController on another Storyboard that's embedded in a UINavigationController?

ios,objective-c,cocoa-touch,uiviewcontroller
...and have it embedded in a navigation controller. I have a storyboard, let's call it MainStoryboard. On main storyboard (neither is the initialViewController BTW), I have a ViewController, let's call it ViewControllerZ, embedded in a NavigationController, let's call it NavigationControllerZ. Upon a user clicking a button... I had... UIStoryboard *storyboard...

iOS - presentViewControllerAnimated vs window.rootViewController

ios,swift,uiviewcontroller
I have a class MasterViewController that loads on app startup. Inside viewDidLoad() it checks if a user is logged in, and presents one view controller or another based on the outcome. If you aren't logged in and then proceed to do so, the app loads up a new MasterViewController. My...

Why the 20px gap at the top of my UIViewController?

ios,layout,uiviewcontroller,xamarin
The Problem Consider the following controller hierarchy: UINavigationController UIViewController UITableViewController The presence of the UIViewController is affecting layout. Without it, the UITableViewController takes up the entire bounds of the UINavigationController: However, if I add a vanilla UIViewController between the UINavigationController and UITableViewController, a 20px gap appears between the top of...

Add Delay to PresentViewController

objective-c,xcode,uiviewcontroller,segue,viewcontroller
I was wondering how to add a 1.0 second delay to this segue I have in my code: UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *homeViewController = (UIViewController *)[storyboard instantiateViewControllerWithIdentifier:@"HomeViewController"]; [self presentViewController:homeViewController animated:YES completion:nil]; I know you can do this: [self performSelector:@selector(showModalTwo:)withObject:someNumber afterDelay:1.0f]; I just dont have this or want...

How can I present a custom view modally without using presentViewController?

ios,swift,uiviewcontroller
Is it possible to present a view controller modally using addChildViewController? I want to present a UIviewcontroller's view modally so it overlaps any views under the window hierarchy. I want to do it without using the self.presentViewcontroller because I want to build my own animation instead of using the preset...

How can I place two views in a single screen using autolayout Constraints

ios,objective-c,uitableview,uiviewcontroller
I would like to create apps which have 2 views (top & bottom). The top view is scrollable and contains multiple textfields and labels. The bottom view is non-scrollable but needs to auto adjust to fit into bottom screen like a keyboard when the screen size is changed (I want...

Why is my swift code pausing at the loading screen?

ios,swift,uiviewcontroller,segue
if timerRunning == false{ timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("counting"), userInfo: nil, repeats: true) timerRunning = true } while timerLabel.text != "0"{ gameViewStillRunning = false } if gameViewStillRunning == false{ self.performSegueWithIdentifier("segue", sender: nil) } The purpose of this code is to display a label counting down, and then when...

Extra table cells when UITableViewController is embedded into a Container in a UIViewController

ios,swift,uitableview,uiviewcontroller
In order to customize a table view and add some additional controls to it, I've embedded a UTTableViewController into a Container View and placed that container View into a UIViewController. I've followed the instructions I found here: Embedding TableView in TableViewController into another view TableView is configured with four static...

How do I keep a UILongPressGestureRecognizer active while switching from a UIViewController to another

ios,objective-c,uiviewcontroller,uigesturerecognizer,uilongpressgesturerecogni
At some point in my app, a user can move a UIView after a long press on that view. This works fine. When the view passes over a specific region, the app has to switch to another UIViewController. The moving view is attached to this new controller. So far so...

Hidden Values in UIPickerView

ios,uiviewcontroller,xcode6,uipickerview
As beginner in iOS Developing I struggle with specific implementation ofUIPickerView. I already know how to createUIPickerView with specific data. My goal is a bit complicated though - I would like this PickerView to print me selected value. For example - like in simple currency calculator - I pick EUR...

Different storyboard's entry points depending on a parameter

ios,login,uiviewcontroller,storyboard,entry-point
I'm developing an app where I need to manage the common scenario of users having to provide credentials to log in and access the main app's functions. This way, the view I need to firstly show the user if she's not logged in is the view to allow her to...

How to remove UIViewController transition animations?

swift,uiviewcontroller
On my storyboard I have two view controllers, and I have a button transitioning to the second one using 'show'. I'm new to viewControllers and I want to know hoe to remove the transition animation. step by step answer preferred....

Container View's Frame Set to CGRectZero when Using Programmatic Auto Layout

ios,objective-c,uiview,uiviewcontroller,autolayout
I have a UIView subclass that will be a tooltip that can appear on the bottom of any view controller to show a hint/error message/success message/etc. The tooltip view has two subviews: a UILabel on the left-hand side and a UIView on the right hand side, that can be anything...

Is it necessary to manually add a ViewController.swift file after adding a new view controller in the story board?

ios,xcode,swift,uiviewcontroller,uitabbar
I am trying to build a tar bar app. I loaded the template of a two-tab app. Here is the file tree -AppDelegate.swift -FirstViewController.swift -SecondViewController.swift -Main.storyboard As you can see, I have two ViewController.swift files. I added a new tab bar item in my storyboard and linked everything together. Everything...

Is MyViewController in the window hierarchy?

ios,swift,uiviewcontroller
Is there a way to check if MyViewController is in the window hierarchy ? I want to know if I can present an UIAlertController from it : var alert = UIAlertController(title: "Hello", message: "Just for fun", preferredStyle: UIAlertControllerStyle.Alert) MyViewController.presentViewController(alert, animated: true, completion: nil) ...

iOS Swift: UIPageViewController - Turning page programatically

ios,swift,uiviewcontroller,uipageviewcontroller
I have a UIPageViewController, which works fine when we swipe left or right to turn pages. class ViewController: UIViewController, UIPageViewControllerDataSource { ... } Now i intend to provide Previous/Next button on the page too, so that pages can be turned by clicking on these buttons. How can i trigger the...

Dismiss and Present same view controller

ios,uiviewcontroller
i have a view controller and i need to dismiss it and present it back in same time. i had tried dismiss it and call back the view controller but not working. [self dismissViewControllerAnimated:YES completion:nil]; UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"Main" bundle:nil]; ExpandViewController *expandView= [storyboard instantiateViewControllerWithIdentifier:@"ExpandViewController"]; expandView.delegate=self; [expandView setEventDict:dict]; [self presentViewController:expandView animated:YES completion:NULL];...

How to add a menu bar to a UICollectionViewController embedded in a UINavigationController?

ios,swift,uiviewcontroller,uinavigationcontroller
I have a navigation controller who's root is a Collection view controller. I'm trying to add a tab menu bar at the top just under the navigation bar and before a scrollable collection view. The tab bar would have two buttons that show the appropriate collection view. Below is the...

Add UISlider to UIView

ios,swift,uiview,uiviewcontroller
I am trying to add a UISlider to a UIView to add to my UIAlertController for an easier but am unsure of the method. In Objective C you would call addSubview but I am unsure of what it is in swift. //UIViewController.alertReminden(timeInterval) var refreshAlert = UIAlertController(title: "Reminder", message: "Set a...

Switch UIViewController to any other UIControlller without drag and drop

ios,uiviewcontroller
So I know how to drag and drop different UIControllers, but for example the UITabBarController comes with additional items, UISplitViewController also with additional items, what if i want to convert already created UIViewController to UITabBarController or UISplitViewController. I've tried editing the XML source, but kinda broke everything what would be...

How do I access an array from one viewcontroller in another viewcontroller

ios,arrays,swift,uiviewcontroller
I am very new to the swift language and am trying to make an app that would do some basic calculations. The problem I am running into is that I want to use the values from an array that is declared in one viewcontroller in another viewcontroller to do calculations....

Alert not working due to presentViewController

ios,uiviewcontroller,uialertcontroller
Seems that calling an Alert in my UIViewController causes ploblems with the presentViewController (...due to probably inadvertently trying to present the same view controller twice in quick succession...). What could I do against that issue (...see code below) ??? Error message : <MyApp.MyViewController: 0x67544325620> which is already presenting (null) The...

IOS prepareForSegue pass a data successfully but viewdidload clear it?

ios,uiviewcontroller
In UIViewController A I performSegue to UIViewControllerB.And in the prepaerForSegue function of A, I use set function set a strong variable 's value of B. However, when the B's viewDidLoad() called, the value is nil. Anybody help me and tell me why? my code is: UIViewController A: - (void)prepareForSegue:(UIStoryboardSegue *)segue...

Presenting UIAlertController from UITableViewCell

ios,uitableview,swift,uiviewcontroller
I am trying to add alerts to a custom UITableViewCell to present an UIAlertView I need to call presentViewController from UIViewController. However, I am unaware of how to gain access to the current UIViewController instance from the UITableViewCell class. The below code is my attempt to do this with an...

Getting a UIVIewController from a storyboard by overriding it's designated initializer

ios,swift,uiviewcontroller,storyboard
In Objective-C, I often override my UIViewController subclass's init like this - (id)init { self = [[UIStoryboard storyboardWithName:@"..." bundle:nil] instantiateViewControllerWithIdentifier:@"..."]; return self; } So that when I need to use it, I can simply call id controller = [MyViewController new] Is it possible to do similar thing in Swift, so...

iOS - Programmatically Set A UIContainerView's Embedded UIViewController

ios,objective-c,xcode,uiviewcontroller,uicontainerview
I have a UIViewController with a UIContainerView inside. Based on whether a certain condition is true, I'd like to programmatically set the container view's embedded view to a different UIViewController. I noticed that you can have only one embed segue to set one UIViewController, so is there a way to...

Change background color of viewcontroller but not top area with clock

ios,user-interface,uiviewcontroller
I want to make my whole ViewController grey except I want the top area where it shows CARRIER and the current time to remain white. Is the only way just to stick a View that covers everything except that area, and set it to grey, or is there some way...

Touchesbegan method inactive from viewcontroller

ios,swift,uiviewcontroller,touchesbegan
When I am adding a UIImageview from the viewcontroller, I want to make the touchesbeganmethod inactive till the uiimage is pressed. Now I already have everything set up, I just need to know how I can prevent the gamescene from noticing touches by setting up code (only) in the viewcontroller....

After HealthKit access go to ViewController but elements show after 5 seconds

ios,swift,uiviewcontroller,health-kit
In my app I ask for HealthKit access and that works fine. I get permission to read the step count and flights climbed. After the permissions are authorized I want to send the user to a new ViewController. This works fine but the elements in that ViewController are shown after...

Swift - Adding background image behind a Sprite Kit Scene in View Controller

ios,swift,uiviewcontroller,sprite-kit
I am trying to add a background image in my view controller so my sprite kit game scenes can be in the foreground. It's important for me for my background image to stay on screen while the game scenes transition to each other. The problem I am having is how...

IOS - Objective C - How do I remove Tableview Menu from my Login View Controller?

ios,objective-c,uitableview,uiviewcontroller,xcode6
In my iOS Project, there is a login ViewController that sends the user to a TabViewController if he has the right credentials. This TabViewController has 5 tabs, the fifth one is for Logout, which send the user back to the Login ViewController, and of course clears out the already filled...

Opening view controller from app delegate using swift

ios,swift,uiviewcontroller,appdelegate
I am trying to create a push notification which determines which view to open according to information obtained from the push. I have managed to get the information from the push, but I am now struggling to get the view to get the view to open Looking at other stack...

How to determine, in an app with several ViewControllers attached to NavigationControllers, what the currently displayed View is?

objective-c,uiviewcontroller,ios8,uinavigationcontroller,uitabbarcontroller
I have an iOS 8 app, built with Objective-C, with a TabBarController, with 3 tabs. Each Tab links to a NavigationController (so there are 3 NavigationControllers), and each NavigationController has a stack with several ViewControllers in it. So, at any given time, the app's user can be on, say, ViewController...

Cannot create a connection between a UIImageView and the ViewController.h

ios,objective-c,uiviewcontroller,uiimageview
I cannot create a connection between theUIImageView and the ViewController.h. When I try to type it up manually, and drag the line to theUIImageView, it doesn't highlight theUIImageView, and the connection is not made. When I tried to connect it automatically, but the connection was also not made. Can you...

Circular presentation of UIViewController

ios,objective-c,uiviewcontroller,presentviewcontroller
Basically I'm wondering what the proper way to present and release view controllers is. My original understanding was that ViewControllerA presents ViewControllerB with -presentViewController: Animated: Completion:. Then ViewControllerB can release himself by calling -dismissViewControllerAnimated: Completion:. Now, if I have three view controllers, A, B and C. A presents B, B...

iOS UIPageControl not show correct pages number when I using subview call parent view

ios,objective-c,iphone,uiviewcontroller,uipagecontrol
I have MainUIViewController(named withFlightSettingsContentViewController), that contain a container view, the container view is theUIPageViewController(named withFlightSettingContainer); But the layout have to set a pageControl element on the MainUIViewController(FlightSettingsContentViewController), So I drag a page control on the MainUIViewController. But when the container view(subview -FlightSettingContainer) load, I want to set the main viewcontroller's...

Load a UIViewController with data from .plist [closed]

ios,swift,uitableview,uiviewcontroller
I have a UITableView set up in storyboard with static rows populated with different content, and all going to a single UIViewController. I've also got a separate plist for each view I intend to load (containing the different content), that I would like loaded depending on which row was selected....

Swift - Passing data along with segues

ios,swift,uiviewcontroller,delegates,segue
here's the problem: I'm trying to pass along some data from one ViewController to another InfoViewController. It looks like this: Running, the app, it looks like this: Beside this two view controllers, I have some other ones in this app and their Segues are working perfectly, but, when I tap...

UiAlertView should change ViewController

ios,objective-c,uiviewcontroller,uialertview
What is wrong with following code? I will change the viewController, when the text in the alertView is not empty. The problem is, it will change the UiViewController every time, even it is empty. - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex == 0) { if ([[alertView textFieldAtIndex:0].text isEqual:@""]) { UIAlertView *alert...

Need help figuring out iOS 8 bug/glitch

debugging,ios7,uiviewcontroller,ios8
I have 2 view controllers in game App. 1st VC is no gameplay only intro. 2nd VC is gameplay and GameOver screen. On GameOver screen is a BACK button that takes you back to 1st VC. On GameOver is also Final score and High Score. Example, current Final score =...

Swift ios not sure on how to connect or use an embedded UIPageViewController

ios,swift,uiviewcontroller,segue,uipageviewcontroller
I decided to drop my UIImageView and instead use an UIPageViewController so that users can swipe between images on the same page. What I have now is a normal UIViewController, in that I added a containerView in which I have embedded a UIPageViewController. So the UIPageViewController acts as a childview...

IOS: Transition with modal ViewContorller

ios,uiviewcontroller,transition,modalviewcontroller,transitions
I have custom action sheet that I create as VC. I present it with 'overCurrentContex' with the code [self presentViewContoller:myVC animated:YES completion:nil]; I need to add dark background to it. I added it with code self.view.backgroundColor = [UIColor colorWithWhite:0.5 alpha:0.5]; But as I present it modally it slides from the...

UIViewController LifeCycle

swift,uiviewcontroller,segue
I just tried some stuff using View Controller delegates and learn about their functionalities. There is one thing I would like to try: I wrote a function to unwind programmatically a viewController by using the segues. The views are inside a navigationViewController. Additionally I set a instance var inside my...

Call storyboard scene without creating a segue in swift?

ios,swift,uiviewcontroller,segue
I created a scene and tried to link the class to the scene and create a segue with the storyboard and use self.performSegueWithIdentifier("SegueID", sender: self) and no matter what I did (i.e. clean build) I still got the same error "reason: 'Receiver () has no segue with identifier 'SegueID''" I...

Where is the first good moment to take a screenshot in UIViewController

ios,objective-c,uiviewcontroller
I would like to make a screenshot of my view when view is loaded. I use this method: - (UIImage *)screenshot { UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0.0f); if( [self respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)] ) { [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES]; } else { [self.layer renderInContext:UIGraphicsGetCurrentContext()]; } UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return screenshot; } The screenshot...

Start uitabviewcontroller with screen not on tabbar

ios,swift,uiviewcontroller,uitabbarcontroller
My uitabbarcontroller has 5 tabs, but when the initial uitabbarcontroller is loaded I want to display a viewcontroller that is not any of these 5. I also want none of the 5 to be selected. The most recent questions that I have found were for iOS 5 and in the...

dismiss a modally presented view controller to a different underlying view controller

ios,uiviewcontroller,segue
I have a UIViewController that's embedded in a Navigation View Controller. I then modally present another view controller that shows a countdown. Once the countdown ends, the modal view controller should be dismissed and show a different underlying view controller from the original presenting UIViewController. Does anyone know how to...

Multiple ways to present UIViewController's view [closed]

ios,objective-c,uiview,uiviewcontroller
I'm fairly new to iOS and working on someone else's project, and I notice that there seems to be various different ways to present a view. I'm wondering if someone could give a brief summary of the various ways to present a view, and when to use which one, because...

How to subclass different View Controllers in Swift

ios,swift,uiviewcontroller,xcode6
How do I subclass different view controllers? This is what I've been trying to use: class secondViewController: UIViewController { This returns the error "Use of undeclared type UIViewController." What am I doing wrong? I have started this class in a new .swift file, is that somehow contributing to the problem?...

first tap not registering on collectionView Xcode

objective-c,xcode,ios7,uiviewcontroller,collectionview
I have a collectionView with an array populating it. I have it set up that when a cell is tapped a second modal view is presented. The problem is that the first tap is not recognized. The collectionView in storyboard, along with the cell and the image inside the cell...

How to declare properties with a for loop in Xcode

ios,xcode,swift,for-loop,uiviewcontroller
I have about 80 CALayer properties I need to add to a UIViewController and I'm wondering if anyone knows a way to do this with a for loop as opposed to me copying and pasting 80 lines of code like this: var colorButton1 = CALayer() var colorButton2 = CALayer() var...

UITableView Flickering with UIRefreshControl

ios,objective-c,uitableview,uiviewcontroller,uirefreshcontrol
I have aUITableView withUIRefreshControl defined inside the viewDidLoad: method of aUIViewController as below: - (void)viewDidLoad { [super viewDidLoad]; self.refreshControl = [[UIRefreshControl alloc] init]; [self.refreshControl addTarget:self action:@selector(refreshMessages) forControlEvents:UIControlEventValueChanged]; UITableViewController *tableViewController = [[UITableViewController alloc] init]; tableViewController.tableView = self.messagesTableView; tableViewController.refreshControl = self.refreshControl; } -...

Hide a UIViewController (Screen) in swift

swift,uiviewcontroller,uitabbarcontroller,segue,xcode6.3
As you can see the screen flow as follows: After clicking on the 'button2' of 'screen A', app shows 'screen B' from same storyboard which has a tab bar. After clicking on the 'red tab' of 'screen B', app shows the 'green button'(right corner). After clicking on the 'green...

Connecting Objects with two View controllers in Swift

ios,swift,uiviewcontroller
In my project I have two view controllers, and I am having trouble connecting objects such as an UIImageView to the view controller. When I try to create the IBOutlet, it tells me that "Could not insert new outlet collection: could not find any information for the class named UIViewController"....

Call method after asynchronous request obj-c

ios,objective-c,asynchronous,uiviewcontroller,nsobject
In my app I init a new object, where there is method which calls NSURLConnection's sendAsynchronousRequest method. After the request, I would like to call a method in the caller UIViewController. I tried to use a static method but I then I can't control IBOutlets. How can I do this?...

How to load text from UITextField and show it in UITableView every time textfield return text

ios,objective-c,uitableview,uiviewcontroller,nsmutablearray
I am aware this question has been asked before but the answer is not clear The problem is that theUITableview is using data fromviewDidLoad method where theNSMuatableArray has been allocated and initialised but contains void. But in the textfield method oftextFieldDidEndEditing,NSMutableArray do contain text from textField. I have a single...

Queuing ViewControllers to be Pushed One By One

ios,objective-c,swift,uiviewcontroller,uinavigationcontroller
How do we "queue" ViewControllers to be pushed one by one? My app check for number of "Friend Requests" and I would like to push one by one from one to another. Check for Requests Found 3 Requests Push FriendRequestViewController User Press OK Push Another FriendRequestViewController User Press OK Push...

How to move up a modal UIView inside of a UIViewcontroller (StoryBoard)

ios,iphone,uiview,uiviewcontroller,keyboard
i've got a UIView, dragged of Object Library, inside of a UIViewcontroller created by StoryBoard. Inside of this UIView, I put two Text Field to grab user name and password, and one button to log in. How can I move only this View when the keyboard appears? I'm able to...

Redrawing UIViewController and its subviews

ios,xcode,uiview,uiviewcontroller,storyboard
I have a UIViewController with many subviews like UILabels, UIImages and a UIWebview. With a defined action by the user, the subviews of the UIViewController animate to different sizes and different locations inside of the UIViewController's view. Is it possible that this can be undone with a different defined action...

How to change textView in separate ViewController from button in another ViewController?

ios,xcode,swift,button,uiviewcontroller
I have a Collections View that includes various cells that are also buttons. Upon clicking one of those buttons, a separate ViewController is shown (I just connected the button to the ViewController and clicked "show"). I would like to know how to switch the textView in that separate ViewController for...

ViewController Does Not have member named “allValues”

ios,xcode,swift,uiviewcontroller
This is kind of a common question, but I could not find an answer that solved my specific issue. I am creating a program that takes in a user entered credit card and returns the type of credit card. Everything seems to check out except I keep getting the error...

How to redisplay parse login from child view controller in swift

ios,swift,uiviewcontroller,parse.com,uitabbarcontroller
I have a view controller which is triggered from a UITabBarController (which is the root of my app) if a parse session doesn't exist. override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) self.initialiseLogin() } func initialiseLogin() { if (PFUser.currentUser() == nil) { let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil) let vc:...

Navigation From One View Controller to Another

xcode,swift,uiviewcontroller,ios8.3
I am a .Net Developer and just started my first iOS project using swift. I want to navigate from one view controller to another using code. Like we do in WP 8.1 with the help of following code: Frame.Navigate(Typeof("Page_2")); ...

Loading UIViewController “from” Nib File

ios,xcode,uiview,uiviewcontroller,xib
I am trying to create an UIViewController from a Nib file. On Google I found that I can only load an UIView from Nib. But some suggests that I could create a Nib file (of UIView) whose File Owner is set to our ViewController. That is what I did, I...

Best way to switch UIViewControllers based on different input in an ios application

ios,swift,uiviewcontroller,uikit,xcode-storyboard
What I am trying to do simply change views based on some data. To demonstrate exactly what I am trying to do I have constructed a little example to demonstrate. I used a UISegmentedControl to simulate data data then when a button is pressed, it would switch between views based...

Swift iOS: Perform a Segue from an Instance in a ViewController to another ViewController

swift,button,uiviewcontroller,segue
First of all, I have to say that there is so much information on this platform, because of everyone, who is helping. Thank you very much. At the moment, I have reached a point, where I am not able to go further on my own. This is my problem: I...

Change UIButton image on click in a custom UITableViewCell

objective-c,uitableview,uiviewcontroller,custom-cell
I have defined two different UIButton's in my custom UITableViewCell. This custom UITableViewCell is used in a UITableView inside a UIViewController. Now i would like to change the UIButton's image on click. I tried it with protocoll and delegate but it doesn't work. Any idea how i can do this?

UiviewControllers inside UICollectionViewCell

ios,objective-c,uiviewcontroller,uicollectionview,uicollectionviewcell
I have a UICollectionView inside a UIViewController. The collectionView holds an array of 8 identifiers of view controllers from the storyboard. Each view controller in the array inherited from the UIViewController that holds the collectionView. Here is the code: - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { return _contentPageRestorationIDs.count; } - (UICollectionViewCell *)collectionView:(UICollectionView...

Could not cast value of type 'UINavigationController' (0x10836e698) to 'UITabBarController' (0x10836e6e8).?

xcode,swift,uiviewcontroller,uinavigationcontroller,uitabbarcontroller
This is the code for UITabBarController in which I am trying to open a splitviewcontroller. import UIKit class SecondViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } override func viewDidAppear(animated: Bool) { super.viewDidAppear(animated) ///here after this line I am getting error var mainCont : UITabBarController = ((UIApplication.sharedApplication().delegate) as! AppDelegate).window?.rootViewController as!...

iOS - How to present different scenes from UITableViewCell

ios,objective-c,uiviewcontroller,tableview,tableviewcell
I have a UIViewController with a TableView. The TableView is populated with an image and a text for each cell. Now I need to present others Scenes when the user taps a cell. For example: - tap on first row --> present ViewController1 - tap on second row --> present...

How to move to an existing UIViewController (in storyboard) with code in swift

ios,swift,uiviewcontroller
I know how to do it with buttons by clicking and dragging, but I have a situation where I need a transition without a button. so what code will allow me to transition from the current UIViewController to a different UIViewController that is already initialized?

Pass data from one view controller to the next WITHOUT a segue in swift

iphone,swift,uiviewcontroller,ios8,segue
So I have an app that where you choose a button in the first screen it will bring you to another screen depending on which one you chose on the first one. Because I have these possible different layouts I can't just use a segue from one button to the...

How to reload data in a TableView from a different ViewController in Swift

ios,swift,uiviewcontroller,reloaddata
In a ViewController, I'm trying to reload data in a TableView in another ViewController like so: (self.presentedViewController as! tableViewController).table.reloadData() Where tableViewController is the class in the TableView's controller (It's not upper camel case, I know) and table is the TableView. Well, doing this yields "fatal error: unexpectedly found nil while...

Is it not possible to create a UIViewController programmatically without building the view?

ios,cocoa-touch,uiview,uiviewcontroller
I want to create a UIViewController programmatically. No nibs or storyboards. It will basically be created and then presented, and in its own class it will set up an image to be displayed. However, whenever I just alloc init a view controller and present it, it comes out black as...

Adding am UIPageViewController in front of a UIViewController

ios,swift,uiviewcontroller,uipageviewcontroller
When my app starts for the first time it should display a tutorial, which are some screens with a semitransparent background, in front of the first app screen. I tried creating an UIPageViewController object, adding its view as subview of the current screen (self.view.addSubview(tutorialViewController.view)) and the screen is displayed, however...

Navigating beetween two viewController

ios,swift,uiviewcontroller,appdelegate
I have set my initial ViewController as rootViewController in appDelegate because I don't use storyboard. It looks like this way: var window: UIWindow? var mainNavigationController: UINavigationController? func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { self.mainNavigationController = UINavigationController() var mainController: UIViewController? = TineLineViewController() self.mainNavigationController!.pushViewController(mainController!, animated: true)...

Implementing delegate methods in separate class

ios,iphone,uiviewcontroller,delegates
I created delegate and its methods are the same to every VC that it supports. How can I use with out code duplication? My code #pragma mark - UIViewControllerTransitioningDelegate (id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source { CircularTransitionAnimator *animator = [CircularTransitionAnimator new]; animator.isPresenting = YES; self.pointForAnimationOfViewUserPhotos =...

Can we get an array of all storyboard views

ios,swift,uiviewcontroller,storyboard
I'm developping application in Swift. This application has many view and I would like to put a UIProgressView on all views Can we get an array of all storyboard views ? for exemple : self.progressBar = UIProgressView(progressViewStyle: .Bar) self.progressBar?.center = view.center self.progressBar?.frame = CGRect(x: 0, y: 20, width: view.frame.width, height:...

Registering UITableViewController causes an exception in loadView method

c#,ios,uitableview,uiviewcontroller,xamarin
I'm experimenting with the UITableViewController class in Xamarin and found that when creating a new ViewController in Visual Studio and changing the base-class from UIViewController to UITableViewController, the application crashing upon start with the following exception. My ViewController basically looked like this: [Register("MyViewController")] public class MyViewController: UITableViewController { public override...

Base UIViewController with UICollectionView

objective-c,uiviewcontroller,uicollectionview,uicollectionviewcell,xcode-storyboard
I am having UIViewController which I want to use as a base controller for other view controllers. Base controller has a UICollectionView which has all the UICollectionViewCell prototype and some other stub views designed in storyboard. All the child view controllers have one thing in common which is UICollectionView and...

How can I animate some subviews of a UIViewController “off” the screen, and other views “on” the screen?

ios,objective-c,uiviewcontroller,core-graphics
Here's what I'm trying to achieve, I've created 3 pictures which do a better job describing what I want to do better than I ever could. Here's what I want to do... I want to keep "App Title" right where it is. I also have a UIImageView now that takes...

Rotating a VC presented as UIModalPresentationOverCurrentContext

ios,uiviewcontroller,ios8
iOS 8. I am presenting a view controller with presentation style: UIModalPresentationOverCurrentContext. This works great until I rotate my device, at which time the presented view is not properly adjusted. Example: I presented over a portrait context. Entire screen covered by my new view (which has semi-transparencies). I rotate to...

passing info from collectionView to gameScene

uiviewcontroller,sprite-kit,uicollectionview
I have created a game using SpriteKit (GameScene and GameViewController) and Objective-C. Everything there works fine. Within the same App I have created a UIViewController and a second viewController in storyboard that uses CollectionView. I have the collectionView loading the array. I want to be able to tap on a...

UIButton with pushViewController that is declared in another class

ios,objective-c,uiviewcontroller,uibutton
Hi everyone I am trying to add a custom nav bar that is declared in a different class and has a button that make a push action. My initial problem was that when the app was pushing the view because of the uinavicgationconreoller it was crashing, I fixed that somehow...

Creation of ViewControllers by the storyboard vs. by alloc/init

objective-c,uiviewcontroller,ios8,uinavigationcontroller,uistoryboard
I'm using Xcode 6.3, Objective-C. In my storyboard, I create a UINavigationController. I then create a UIViewController and assign it as the root controller of the UINavigationController. I then create a second UIViewController, and connect it to the first UIViewController with a "manual show" segue. So my storyboard has a...

why isnt my second view loading after transition?

ios,swift,uiviewcontroller,sprite-kit
I have two views, the initial one that works fine, and a second one that I am trying to display after I transition to it from a button on the first view. However, when I click the button, the transition happens and the screen goes blank. Below is the viewDidLoad...

UIViewController how to jump to grandparent view?

ios,uiviewcontroller
I have 3 views called A,B and C. The segue between them is "present modally". dismissViewControllerAnimated can be used to jump back to parent view controller, but does it have a way to jump from C to A directly? ...