FAQ Database Discussion Community


Is this an example of UITabBarController?

ios,objective-c,uiviewcontroller,uitabbarcontroller,viewcontroller
I would like your help to understand whether the native iOS weather app utilizes or not a UITabBarController (or is this a different view controller?) with multiple ViewControllers inside. Here is the screeenshot: Doubts: Is the bar at the bottom a tab with custom images? Is each city associated to...

Adding tag after switching view controllers

ios,tags,segue,viewcontroller
I have a randomly generated int that I assign to a tag for a UIImageView on my storyboard in ViewWillAppear. When I segue to the main menu and try to enter the view again, however, the app crashes. I know it's because of the tag because when I remove it...

Viewcontroller Dealloc Method Never Gets Called

ios,objective-c,viewcontroller,dealloc
I know there are many questions like this. I read all. My problem is very simple. I created a single view app from xcode file>new project>single view app. Then i added a second uiviewcontroller in storyboard and a new viewcontroller class named secondViewController. I dragged a button to main viewcontroller...

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...

How to connect two view controllers with one button?

ios,objective-c,viewcontroller,uistoryboardsegue
I have one button in main screen. When user clicks "Search" button, I will search that user in database whether he signed in or not. If he already signed in, I will show "Sign Out" screen. If not, I want to show "Sign In" screen. I connected "Search" button and...

Get the top ViewController in iOS Swift

swift,uialertview,viewcontroller,uiwindow
I want to implement a separate ErrorHandler class, which displays error messages on certain events. The behavior of this class should be called from different other classes. When an error occurs, it will have an UIAlertView as output. The display of this AlertView should ALWAYS be on top. So no...

How to pass button title to next view controller in Swift

ios,swift,uibutton,segue,viewcontroller
I have several buttons defined in a loop in viewDidLoad. They are inside a content view, which is in a scroll view. for var i:Int = 0; i < colleges.count; i++ { let collegeButton = UIButton.buttonWithType(UIButtonType.System) as UIButton collegeButton.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 30) collegeButton.center = CGPoint(x: self.contentView.center.x, y: 30...

Can't see elements from storyboard inside viewcontrollers

ios,storyboard,viewcontroller
some elements from my storyboard don't appear since I change the viewcontroller size to 4.7inch. But if I create another viewcontroller and I put some object inside, they are appearing. What's wrong with these viewcontrollers? ...

How to initialise and create object of UITableViewController?

ios,uitableview,uistoryboard,viewcontroller
I want to create object of UITableViewController and want to pass values from ViewController to UITableViewController. But It gives error like "UITableViewController is not key-value coding-compliant for the key superclass." I tried this but won't help: [[MytableViewController alloc] initWithNibName:[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"MytableViewController_identifier"] bundle:[NSBundle mainBundle]]; ...

how to implement ads on 2 view controllers

singleton,admob,viewcontroller,banner,didfailwitherror
I want the iAd/AdMob mediation banner to NOT be affected by what ViewController I'm in. Currently. When I change View Controllers didFailToReceiveAdWithError is called and the AdMob banner in that method appears when I change ViewControllers. I use 2 ViewControllers for my entire app, so is there a way to...

Trigger Segue Artificially

osx,swift,segue,viewcontroller
I am trying to pass data between two viewContollers in an OS X storyboard application using Swift. When I press a button on VC1, it opens VC2, and prepareForSegue is run. However, I can't pass data back to VC1 because a. prepareForSegue isn't being run (because a window isn't being...

Pass data beetwen view controller [duplicate]

ios,objective-c,segue,viewcontroller
This question already has an answer here: Passing Data between View Controllers 29 answers I'm trying to passe an object (PFObject) from an view controller to another, -(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { RestauCardViewController *restauCard = [[RestauCardViewController alloc]init]; RestaurantAnnotation *restoAnnotation = (RestaurantAnnotation *)view.annotation; restauCard.restaurant = restoAnnotation.restaurant; [self...

Passing Data from ViewController to instantiated custom viewcontroller

ios,objective-c,data,viewcontroller
I am trying to pass in data from my database into UILabels in a new viewcontroller instantiated in this function. I have tested to see if the data is being grabbed correctly, and that is working fine. I believe I am not referencing the UILabels in my DataViewController correctly for...

iOS Swift, returning to the same instance of a view controller

ios,swift,viewcontroller
I have a problem, where I have two view controllers A and B. View controller B has a map, with a route draw on it. I can move back and forwards between the two view controllers at the moment, but the B view controller is reset every time it loads....

Linking View Controllers through button

swift,button,xcode6,viewcontroller
I'm a beginner at all of this...Having said that I've come across a point in my app where I've stalled and don't know what to do or fix next. So any answers would be appreciated! So in my Home View Controller, I have four buttons with four different categories. Each...

Insert break / sleep after showing a hidden button

ios,swift,hidden,viewcontroller,break
I want to make a button appear, then I want to show it for 1 second and after that the view controller has to change. I tried my best. but it doesn't matter where I put the sleep(1); - it always does the same. It waits for 1 second, then...

I am trying to pass a string from one view controller to another view controller while unwinding using segues and I am not able to do so

ios,swift,segue,viewcontroller
It shows that the source view controler does not have the string variable so what should I do? This is the code in my source view controller @IBOutlet var textfield: UITextField! @IBOutlet var tofirstbutton: UIButton! @IBOutlet var tosecondbutton: UIButton! var s:String! override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier...

Pass data on segue after loading from remote

ios,swift,segue,viewcontroller
I have controller with this code: var adItem: JSON! var item: JSON? { didSet { self.loadAdData() } } func loadAdData() { let url = "\(Config.apiAdsUrl)\(item!)/" Alamofire.request(.GET, url).responseJSON { (request, response, json, error) in if (json != nil) { var jsonObj = JSON(json!) self.adItem = jsonObj } } } override func...

Can two View Controllers have the same view?

ios,swift,view,viewcontroller
Right now in my ViewController, when a button is clicked, the user loads a photo from their library, and the photo is put on the canvas. However, because I have 2 viewcontrollers, 1) ViewController, 2) PhotoViewController, the user is taken to a new blank View after after she selects a...

Xcode won't open up ContentViewController but stays on the launch screen

ios,xcode,swift,debugging,viewcontroller
I am trying to compile my Xcode application. It builds successfully however it doesn't get past the launch screen. Also It keeps referring me to this particular line of code: instantiateViewControllerWithIdentifier (full code below) and in the logs I get this message: Unknown class ContentViewController in Interface Builder file. Could...

Passing data between views in ONE ViewController in Swift

ios,swift,view,viewcontroller,subview
All of the searches I've done focus on passing data between view controllers. That's not really what I'm trying to do. I have a ViewController that has multiple Views in it. The ViewController has a slider which works fine: var throttleSetting = Float() @IBAction func changeThrottleSetting(sender: UISlider) { throttleSetting =...

iOS - Adding Subviews to Child View Controller view

ios,objective-c,cocoa-touch,frame,viewcontroller
I am trying to add subviews to the view of a child view controller. The child view controller is created when a button is pressed. The parent view controller is inside a navigation controller. -(void)weightPlatePressed:(id)sender { NSInteger week = self.weekControl.selectedSegmentIndex + 1; NSInteger set = self.setControl.selectedSegmentIndex + 1; NSInteger max...

Error saying the viewController does not exist.iOS Xcode

ios,objective-c,iphone,viewcontroller
In my app, It is showing some error like : "unknown type name 'purchasedViewController'; DId you mean 'UIPageViewController'? But actually there is a VC named purchasedViewController and i have imported it in the current VC. But when i create an object of purchasedViewController in the current VC like: @property(strong, nonatomic)...

ViewController: create window

extjs,viewcontroller,extjs5
In ExtJS4 it was possible to do in a Controller: Ext.define('App.controller.Main', { extend: 'Ext.app.Controller', views: ['App.view.SampleWindow'], refs: [{ ref: 'sampleWindow', xtype: 'samplewindow', autoCreate: true }], init: function(application) { var win = me.getSampleWindow(); win.show(); } }); How can I accomplish this in a ViewController? The Viewcontroller has no refs property. And...

Simpler alternative for accessing master object from nested listview on XAF

c#,listview,nested,viewcontroller,xaf
I want to know if there is simple and clear method other than this for accessing master object from a nested listview controller. ((PropertyCollectionSource)((ListView)View).CollectionSource).MasterObject Do I have to write this in everywhere where i need to access master object? I think this is not an elegant way and looks so...

Performwithsegue and programatically switching views - Objective-C

objective-c,segue,viewcontroller
I am having a problem, I want to change to another viewcontroller when a timer expires and this works with this code: - (IBAction)Akkoord:(id)sender { UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; UIViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"Innameformulier"]; [self presentViewController:vc animated:YES completion:nil]; [self performseguewithidentifier:@"nextcontroller"] } But when I use this, my variables...

Wrapping a collection view in a view controller nil delegate error

ios,swift,uicollectionview,viewcontroller
I have a view controller wrapping a scrollview which then holds a collection view and a content view. When I run I get a null pointer exception assigning the collection view delegate in viewDidLoad: collectionView.delegate = self collectionView.dataSource = self collectionView.backgroundColor = UIColor.clearColor() Not sure why, i have implemented protocols...

Trouble with scrollview

ios,objective-c,uiscrollview,viewcontroller
I have a strange problem with a ScrollView. I currently have 4 TextFields and 4 Labels on one ViewController, and when the keyboard pops up, it obstructs the view of 3 of the 4 pairs of TextFields and Labels. I added a ScrollView, but when I did, I was suddenly...

Could not find a storyboard named 'Main' in bundle NSBundle?

xcode,localization,storyboard,main,viewcontroller
While trying to localize a SpriteKit game i suddenly started getting the error: "Could not find a storyboard named 'Main' in bundle NSBundle" I wasn't use a storyboard, and i think i actually deleted the file when i first started developing the game. 'Main storyboard file base name' was set...

How to have my ViewController use a different storyboard? xCode 6.3

xcode,storyboard,viewcontroller
I duplicated a storyboard, and changed colors is all. What do I need to do to link my ViewController to use this other storyboard? thank you.

Get store in a ViewController

javascript,extjs,viewcontroller
Is it possible to retrieve a store from within a ViewController? I'm trying to dynamicaly populate a toolbar with buttons from a store, but I'm not sure how to access the store from the controller. Any hints appreciated. My Extjs version is 5.1. View: Ext.define('EurocampingsCMS.view.Foo', { extend: 'Ext.toolbar.Toolbar', alias: 'widget.foo',...

How can I pop to any view controller as I wish?

ios,viewcontroller
view controller A B C D A -> B -> C-> D popViewController only form D to C popViewTopController only form D to A; Any way can I pop to any view as I wish if I have 10 view controllers? Thanks for everyone. will the popViewController pop to a...

Swift - call function without initializing the controller

ios,xcode,swift,viewcontroller
I'm stuck on something simple & complicated for me at the same time. I'm creating an app using Swift that works with SocketRocket and WebSockets, once a simple ViewController (class myVC) is loaded, within the viewDidLoad() I call a function, send the message to the server and get the response...

How to change the value of a certain core data across VCs/ How to know the index of a created CoreData?

core-data,segue,viewcontroller
I start from a TableView to create and store user information. This is how I create a core data entity called "Trials" in CreateTrialViewController. And I can successfully fetch it in the tableViewController after I come back to it. let trial : Trials = NSEntityDescription.insertNewObjectForEntityForName("Trials", inManagedObjectContext: self.managedObjectContext!) as? Trials {...

Crash on pushViewController

ios,swift,viewcontroller,pushviewcontroller
I'm trying to push a ViewController, but my app crashes every time. I'm using the UIImagePickerControllerDelegate to take a picture, and once the picture has been taken, this code runs: func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) { let pickedImage = info[UIImagePickerControllerEditedImage] as! UIImage // Reset the cameraButton and...

XCode 6.2 bug on Master/Detail project template?

ios,viewcontroller,simulator,master-detail,xcode-6.2
This happens also on a blank Master/Detail project when using XCode 6.2 beta. In other words: it works on the simulator but gives me the error below when I run it on an iPhone 5 with iOS 7.1 installed (I don't have any other device to test it on). Below...

iOS C# Development with ViewControllers

c#,ios,uiviewcontroller,xamarin,viewcontroller
I am aware this has been probably answered in several places but I cannot find one solution that has so far worked. Currently I am working with Xamarin.iOS. So I have three empty ViewControllers in my .storyboard file. When the app loads, in the ViewDidLoad() I create two buttons, a...

iOS: Go back to previous view

ios,swift,viewcontroller
I have two views like this in Story Board: [View1] -> [Navigation Controller] -> [View2] To go from View1(has tableview) to View 2, i do this on click of a row on View1: self.performSegueWithIdentifier("showmyview2", sender:self) This works. Now i have a button on View 2, which when clicked should take...

iOS Segue opening two view controllers (assuming two table cells clicked)

ios,uitableview,segue,viewcontroller
When I click a table cell in my application it opens two view controllers. Which it seems to assume that I have clicked two cells, since it opens the cell before and the one I have clicked. The first 3 cells are pretty much static, every other cell underneath the...

Blurred Background on View not Working Consistently

ios,swift,background,viewcontroller,uiblureffect
Using the following code to make the background of a view blurry is not working consistently. func makeBackgroundBlurry () { var blurEffect = UIBlurEffect() blurEffect = UIBlurEffect(style: UIBlurEffectStyle.Light) let blurEffectView = UIVisualEffectView(effect: blurEffect) blurEffectView.frame = view.bounds //view is self.view in a UIViewController view.insertSubview(blurEffectView, atIndex: 0) view.backgroundColor = UIColor.clearColor() //add auto...

How do you programmatically add UI / view controllers?

ios,swift,viewcontroller
I'm trying to load a ViewController when a UIView is tapped, but I keep getting an error *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard () doesn't contain a view controller with identifier 'CameraVC3'' I think it's something with not properly adding the ViewController to my storyboard, so...

prepareForSegue (ViewController)

ios,swift,undefined,viewcontroller
Then i try to sent data from one view to another override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "varView" { var viewController = segue.destinationViewController as ViewController var indexPath = self.tableView.indexPathForSelectedRow() viewController.varView = self.exams[indexPath.row] } } I get an error at witch says that ViewController is a undeclared?...

NavigationBar not loading when ViewController is programatically presented

ios,objective-c,uinavigationcontroller,uinavigationbar,viewcontroller
I am attempting to load one navigation controller (BasicSearchController) from another (ViewController). In Storyboard, I have created 2 Navigation Controllers, which are not linked by segues, but are separate Nagivation controllers. Each is linked to ViewController and BasicSearchController respectively, and each view controller has its own title text in the...

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...

Keeping a view controller in it's state after you leave and come back to it- Swift

ios,swift,viewcontroller
Right now I have two view controllers, and when I gather data from my second view controller I display it in a label in my first view controller (a random integer): var FirstInteger = //random integer override func viewDidLoad() { super.viewDidLoad() TotalAmount.text = String(FirstInteger) This works fine, but when the...

Objective C trigger event from presentViewController

ios,objective-c,xcode,twitter,viewcontroller
This: [self presentViewController:tweetSheet animated:YES completion:[self aVoid]]; Gives me the following error: Sending 'void' to parameter of incompatible type 'void (^)(void)' After 'presentViewController' is called I want to trigger another void (aVoid) upon completion. So what causes the error? How can I make it so this works? Context: I'm calling a...

ObjC - presentViewController breaks

objective-c,xcode,show,viewcontroller
I am trying to programmatically show another View Controller. I wrote some code that I learned from examples, it gives no errors. But it Breaks and shows this in green: return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); thread 1 : signal SIGABRT I used this code: UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main"...