How to manage programmatically two Scenekit SCNviews that are displayed inside two viewcontrollers in the main.storyboard? - viewcontroller

I have one scenekit file .scn that is displayed on a SCNView inside a ViewController in main.storyboard.
I can programmatically manage it from ViewController.h and ViewController.m files.
I just want to add another scenekit file, display it in second ViewController and manage it programmatically.

Related

Unable to show popover for a button in xib file

I have a xib file in which there are multiple buttons. I am able to provide functionality to those buttons except one. For one button, I need to show a popover. I've researched and got results for classes inheriting UIViewController but not for UIView.
In detail, I have 3 files - CustomView.xib (in which there are multiple buttons), CustomView.swift (Class to deal with CustomView.xib) and PopView.xib (which I should load one clicking a button in CustomView.xib)
Can someone please help me with this.
The presentingViewController should be responsible for the popover not the UIView. You can write a method in your custom UIView class to present the popover via the presentingViewController

how to hide/ show custom toolbar(s) in a subclass of uiimage picker controller

I subclassed uiimagepickercontroller for a camera based application, and added two custom tool bars.I want to navigate to another viewcontroller before taking a photo and the custom tool bars hidden in the new view.Till here it is working fine.But when i pop back to camera view controller,the tool bars are still hidden.Where exactly should i write the code to unhide the toolbars?? I wrote the code to unhide in viewWillAppear method of camera class.But it is not working
it is correct to write the code under viewWillAppear, but it should be in the viewController (UIViewController)

Use storyboards in a project which has .xib files- iPhone

I want to use generally the old .xib files in my iPhone application. But when it comes to tableViewController storyboard is a lot more convenient in order to make custom cells etc. Is it possible to make a .xib based application and in the middle of it, to use a storyboard for a UITableViewController and its DetailedViewController only?
You can use a storyboard for any part of a program. Storyboards are not an all or nothing concept. You can have just one view controller in a storyboard, or a small network that just represents a subsection of your app.
To use just one view controller from a storyboard:
Add a new storyboard to your existing project.
Add a single view controller to the storyboard.
Assign an identifier to the view controller in the inspector.
Use the UIStoryboard class to load the storyboard resource
Use -[UIStoryboard instantiateViewControllerWithIdentifier:] to create a new instance of that view controller.
Install the view controller some place in your app by doing something like pushing it on to a navigation controller, or run it modally.
Both can work fine together (Storyboards and Nib files). In the TVC that is part of your storyboard, just instantiate the destination VC in code and use the usual initWithNibName method to load the nib file.
You can add a storyboard to any project, but the point of storyboards is to centralize your XIB files into one location rather than having 10 XIB files you can have 1 .storyboard file that contains 10 scenes representing your views. This shows your connections to other scenes, and you can manage all the seques and transitions of each scene. So is it possible, yes you could add a storyboard to your project, but I would recommend you design you entire application in a storyboard if you want to use them.

Where to write in viewcontroller using UITabBar

I have 4 different viewcontroller and these are connect with 4 tabs in UITabBar. I have to write respected code in each viewcontroller but I noticed the code which is written in each viewcontroller is not loading. Where to write code in each viewcontroller when it is loaded after selecting tabs in uitabbar?
You need to create a view controller file for each view (simply right click on the left where the files are and do New File -> UiViewController).
After that, in the Storyboard, select the view, and in the properties, change from the default view controller to the custom one you have created (this is the third icon on the right panel, under "Custom Class"). The UITabBar should handle switching the views, and your code will make the views run uniquely :)

how to add UIImageView overlay over a UITableViewController based controller?

How does one in XCode XIB builder add a UIImageView to an existing MasterViewController that has a TableView and is based on NavigationController?
Scenario
For example if you create a new project based on MasterDetail in XCode 4
Then look at the MasterViewController.xib file - so want to add a UIImageView to this that could be used to overtake the screen up until a point after which the image view is made hidden to disappear.
I'm trying to drag a UIImageView onto the page, and putting it just able TableView in the Objects column, however this doesn't work. Doesn't even show the image.
So even just knowing how to drag-drop an image onto the MastViewController.xib such that it takes over the screen at startup would be a step forward (not sure if I need a view to encapsulate both the UIImageView and the TableView?)
Background
Want to have an intermediate image that the iPhone app shows as it starts up
Idea would be start up (static) image is show, then straight away go to MasterViewController which would show this same static image with an activity indicator on it
Then when (is a background thread) the data preparation is down, the UIImageView could be made non-visible
PS. Some additional notes:
Initially there is just a table view you see in MasterViewController.xib.
If I drag an imageview in at the same level as the TableView it doesn't appear.
If I create a new view in the XIB and put the tableview and uiimageview under this, I get an error when running "'-[UITableViewController loadView] loaded the "MasterViewController" nib but didn't get a UITableView.'"
Is there a view or just a table view in your xib? If you want both a image view and a table view in the same view controller, you should have an ordinary UIViewController and let in implement UITableViewDelegate and UITableViewDataSource protocols and add a table view and a image view to its view.
so solved by:
creating a top level "view" in the XIB
put the UITableView & the new UIImageView under this new view
but, had to change the interface line to inherit from UIViewController NOT UITableViewController
Just add Default.png in resource.