I want a master view and view color , view size ( uiviewcontroller ) Separate. Worked uiview color and size Become a heavy application
Explanation image sorry do not speak English
If I understood you correctly you want to create one parent and few child view controllers in the storyboard. You may use container views for it. Here you can see an expample: http://sandmoose.com/post/35714028270/storyboards-with-custom-container-view-controllers
Note: container views are available for iOS 6+
Related
I am working on a swift project in Xcode right now and one of my view controllers is a UITableViewController. I used swift to alter the size of the table view in the controller so that it does not fill up the entire screen. However, I want to set a background image for the entire view controller which I am unable to do since XCode is not letting me add an image view between the table view controller and the table view. Is there any way to do it using swift? Thank you.
I think I can help out.
If you're using Apple's UITableViewController - does that mean you altered the tableView's height in the storyboard? I think a better solution is to just use a regular UIViewController, add a tableView with whatever height you want it inside a UIViewController's view.
Often times I would recommend steering away from using Apple's custom things because you lose flexibility. Just make your own custom thing instead!
UIViewController > View > TableView & UIImageView
Make sure your tableview has a clear background!
I have a storyboard setup with the main view having a bunch of buttons and a container view and I would like for a different view to be loaded into that container view each time I press one of those buttons, kind of like a tab view controller works but without using one of those.
Also, later on I plan to have buttons inside those views that load other views replacing the views themselves.
Anyone can give me some hints?
Thanks
"Container View defines a region within a view controller's view subgraph that can include a child view controller. Create an embed segue from the container view to the child view controller in the storyboard."
You mentioned NSContainerView, so I assume you're trying to do this on macOS, not iOS. Here's a useful article and code project (for iOS 6, but I was able to set up switchable subviews in iOS 9 using this as a guide):
http://sandmoose.com/post/35714028270/storyboards-with-custom-container-view-controllers
The important bits are using the embed segue, then wiring the view controllers together through a combination of viewDidLoad and prepareForSegue, and then finally loading one of the switchable view controllers (say one for each of your buttons) from the storyboard, where they are not connected to anything else.
How to move a container View in Swift
I'm working on an app that will be just for iPad, and because of the size I am using containers to embed other views. In this app, I need to move a viewController that is within a container.
For example, I created a ViewController and put a Container View. I must use the UIPanGesture in the label, and drag your finger across the screen, move the ContainerView in ViewControler Initial.
Can someone help me?
The container view is just a normal UIView.
Just create a view outlet to your View Controller if you want to move the view using it's frame.
You probably know how to create an outlet connection ?
You can also use Auto Layout and created outlets to your constraints and change their value.
I'm newbie in iOS dev. I need windows with tree views on it. I created view-base application, and added UIView controls in master view. Also i added 3 View controllers for that views with view definition in separated xib files. How to link views from separated xib files with view areas on master view? Should i manually create controller instances and load controller's view into view areas? Or maybe is possible to create them in IB? Thank you.
You should be able to just drag the instances of the three controllers into the nib file of the master view, and resize them in order to create the desired layout. However, make sure that the properties on the subviews are correct or they could overlap. In the library window of IB, go to the classes tab, and drag the classes you want (View Controllers) to the nib.
I prefer that method over manually adding them through code, as it allows much better functionality with resizing such as from rotation.
Sorry but I found no clear answer on that.
I have an iphone app with a tab bar and a UINavigationController in each tab.
The interface is built with Interface Builder, and in the first tab there is a UITableView.
I have prepared the xib with main view (A) containing a table (T) and an image (IMG) background behind (image as subview of main view).
Later I assigned UITableViewController as owner. This is where problems start.
In IB if I connect view to A I got a runtime error telling me that controller cannot find a table.
If I connect controller view to T everything works fine, except that IMG is not shown.
The only solution I found is to create a new xib holding A and IMG with a UIViewController as owner. Then create a xib holding T only and UITableViewController as owner, correctly connected to T.
Then in viewDidLoad of the UIViewController:
iptc = [[IPPlantsTableViewController alloc] initWithNibName:#"IPPlantsView" bundle:[NSBundle mainBundle]];
iptc.navigator=self.navigationController; // <-- need this
[self.view addSubview:iptc.view];
And this works, except that the table view seems to not know anything about navigationController, therefore detail view mechanism is not working, unless I set a property for it in UITableViewController.
I also run in to some other problems, for example all the logic for adding/deleting/creating rows to table has to be handled in UIViewController and sent to UITableViewController.
Is there another way for having a fixed image in a table view ?
Mmmm
I will be honest i HATE Interface Builder ;-) so I can't help you about this.
But to set a fixed image in the background of a UITableView you should :
- set background color of the UITableView to [ UIColor clearColor ] (and maybe the background of the cell too)
- set and uiimageview below the uitableview view that contains the image :)
In that way this should work.
But without xcode project I can't help you more ^^
Good luck
UITableViewController is a convenience class; you can equally just use UIViewController and implement the correct callbacks.
In OS 3.2+, you can just set UITableView.backgroundView. If IB doesn't let you do this, you can do it in code instead.
Alternatively, you might be able to wire up the view and tableView outlets differently, unless tableView just does (UITableView*)self.view.