I'm working on an iPad app and here's my scenario:
I have a view which contains a table view inside of it. When the user selects an item on the table view, I would like the parent's view to change in a navigational manner. For those of you that have an iPad, this would be akin to the "Settings" app. But I guess in the "Settings" app, the right pane is composed of a grouped table view right?
Is what I'm trying to do possible?
Thanks
The UITableView delegate receives any notification on selection and navigational events. Use this methods to simply synchronize the state in the dependent parts of your view.
Related
Sometimes IB simply doesn't allow you to add a view as a subview to a UIViewController as illustrated here
If I drag a UIViewController from the object library and try to embed it within Mailbox View Controller.. it doesn't highlight, however it would work fine if I try to add it to the generic View Controller at the bottom (can the fact that Mailbox View Controller have a Customer Class MailboxViewController have anything to do with it?)
I'm pretty sure I can do this programmatically (which is what I'll try next) but I was wondering if there was a reason for this (and if there was a way around it).
update:
this is what i'm trying to accomplish: I was following the steps here to implement a segmented view controller below search bar like in the iphone mail app.. however I kept on getting an error saying that a view can only belong to one view controller at a time.. So what I'm trying to do is basically create a separate viewcontroller, reference it from MailboxViewController as an outlet, make the containing view of my search area the view of this new view controller (this is where i'm getting stuck) and finally make the searchContentsController property of UISearchDisplayController refer to the view of this new view controller. (if this sounds confusing, which I know it does, please refer to this answer)
From your screenshot, the view property of your mailbox view controller is a table view.
A table view in interface builder won't support the dropping of arbitrary views onto it as subviews - where would it put them at runtime? In IB the table has no content, it just has that visual representation of cells to let you know what it is.
You haven't said what you are trying to set up so I can't offer any additional help. Adding a subview programmatically to a table view probably won't give you the effect you're after either - a table view is a UIScrollView subclass, so your new view will either move off screen or get covered up by the table view adding cells.
When my app launches, I'll have an initial list that the user chooses from. Once chosen, the user should be taken to a UITabController that has content related to the item chosen on the initial list.
For the user to get back to that list, I'd like to have a Title/Tool bar at the top of the app. The bar should contain a title and a button that let's the user get back to that first modal list of items where a new item can be chosen.
I know I can have each individual view controller specify a title as well as a button, but I'd like it controlled at the AppDelegate rather than at each view so that each view doesn't have to contain duplicate logic to accomplish this.
Ideally my app would be a UINavigationController with a UIViewController that contains a UITabViewController; however, it seems that Apple frowns on this type of flow.
Is there a way to manage this?
I don't think there's any way to do this at the tab bar controller level. You could make a subclass of UIViewController to add some methods and properties to take care of your title bar, and then have each of your individual controllers inherit from that class instead of directly from UIViewController
I am working on app. It has normal 3 views. On third view, I have a table view. If I select any row, I want a view which contains UITabController. I have created a simple UITabController app, but unable to do this. How to do this ?
thanks in advance
IMHO, your question is perhaps ill conceived.
A tab bar controller controls view controllers which in turn control views. Your suggestion that a view contains a controller of controller simply does not make sense.
Maybe what you really want on selecting a row in your table view is to present a new view controller and then make the (existing) tab bar visible.
You usually want a UITabBar to be THE navigation for your application and not show it later on one view.
But if you want to do so you should show, as Mundi said, a new UITabBarViewController when you select your UITableViewCell.
I don't know your exact usecase, but if you work with a UITableView I would use a UINavigationController to push a new View when you tap one UITableViewCell. Then it may be better (If you have 2-3 Elements) to use a UISegmentedControl in the UINavigationBar. This would look like this.
I am creating a split view ipad app. I have four buttons in the master view which segue to four different views. However, when I am in certain views I don't need all of those buttons to display in the toolbar. So basically, is it possible to change the buttons for different views in a split view controller? any advice, tutorials, or source code would be sweet
Adding to what Lu Yuan said. You could put a pointer to the instance of the master view in your app delegate so that when one of your subviews load, it can get the master view instance. Then you can hide which ever master view buttons you want.
I am new to iOS and confused about the right way to implement UIPickerView.
I have a UITableView (the list of which is populated by XML File). Now I want to implement an option to trim down that list (say, show only type X or type Y). Now the confusion is, should I implement the PickerView in TableView itself, or make a new segue to show PickerView.
I tried implementing the first one but couldn't get it working.
A picker view wouldn't really fit inside a table view. You should have a button on the navigation bar or toolbar on your table view controller which presents a modal view controller holding your picker view.
This would then feed the selected value back to the table view controller (via a custom delegate protocol method, or similar) and the table view can filter its rows.