In a view of my app I subclass tableViewController and has an activity indicator shown up when the table content is loading. I put it in the center of the screen but it scroll with the tableView (I guess the reason is I add it as a subview of the table view). Is there a way that I can keep the activity indicator in the center of the screen even the table is scrolling?
You could either subclass a UIViewController instead, and set a table property, adding a UITableView as a subclass to the UIView, making it behave exactly like a UITableViewController.
Or, more simply, you could just add the UIActivityIndicator as a subview to the main window.
Related
I have a UIToolbar that I added to a UITableViewController in my Storyboard.
When this view is displayed, the toolbar will show itself directly below the last item in my UITableView. I want to "Dock" my toolbar on the bottom of the screen. I want it to display in the same place every time rather than move around depending on a variable number of table cells in my view. I need the user to be able to see all the cells as well (It can't be covering UITableView items, UITableView needs to decrease its allotted display space). How can I do this?
Edit: Using a UINavigationController to handle my views
You have a couple of options. The first and easiest of the two would be to use a UITableViewController embedded inside a UINavigationController, with the navigation controllers toolbarHidden property set to NO.
The other option is to use a UIViewController. A view controller has a UIView build in, and you can manually add and position a UITableView and a UIToolbar on it in this configuration. Both of these configurations will achieve your desired end result.
I have a screen where I want to display the details of some product. I'm using storyboards.
I have done this using a tableview with static cells, but static cells can only be done within a tableview of UITableViewController. And the problematic point is that I also want to have a Imageview within this controller. this is not possible as the tableview of a UITableViewController take all the screen size.
So I'm doing the Imageview as a subview of the tableview.
I'm wondering if it is the right way to do it, there are similar issues on stackoverflow but none is corresponding to my use case (storyboard + tableviewcontroller + staticcell + sub view)
Without writing any custom code, you could either:
Put a UIImageView in the table view's header or footer view.
Create a static cell and put the UIImageView in that. Table cells don't have to be uniform length, you could make it taller than the other cells if needed.
You can have your subclass of UITableViewController. After you initialize it take its view (tableView) and add it as subview to some other view controller. This way you can set the frame of tableView to occupy the bottom of the (top containing) view controller. To the same view controller you can add additional subviews like UIImageView and position it on the top. The only problems you will encounter might be related to missing notifications to your UITableViewController subclass (viewWillDisappear, viewDidDissappear, viewWillAppear, viewDidAppear, ...). But you can forward them to from your top view controller. Or you could use methods from iOS 5 to add subclass of UITableViewController as a child view controller and position it as you wish. But this is useful if you plan on supporting devices with iOS 5.0+.
See documentation of method in UIViewController:
- (void)addChildViewController:(UIViewController *)childController __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0);
Use a UITableView as a property of the viewController and add it to vc.view, rather than subclass a UITableViewController, then set its frame as you like
Add the imageView to vc. If you need to put it on top of the UITableView, for example, add it as the TableView's header.
Is it a Segmented Control?
About the featured view, is it purely a tableview? how could they make the Segmented Control to be permanent instead of scrolling with the table cells down below?
as Ertebolle says its a UISegmentedControl set as the titleView of the navigationItem.
You can also create elements within the view that don't scroll with the tableview by adding a UITableView as a subview of a UIViewController's view. Setting its frame property means that you can have a scrollable tableview in a fixed certain position in your view and other elements in the view that don't scroll with it.
Yes, I believe it is a UISegmentedControl. But it's set as the title view of the navigation bar - to reproduce the whole effect, you'd create a UINavigationController, push a UITableViewController as the top view in it, and set the titleView of the table view controller's navigationItem to that segmented control. This would automatically anchor the toolbar / segmented control on top.
Is it possible to have a small UITable in a view, where when you click a cell, the small table is transitioned to the detail level? I currently have it so that the whole screen slides to the detail level.
thanks
Instead of creating a UITableView/UITableViewController, create a UIView/UIViewController and drag-drop the UITableView to your UIView. Set the size and position of the tableview as you want and make the UIViewController the tableview's delegate and datasource.
What you have to do is create another view controller and lay it over the top.
to make a UITableView co-exist with a UINavigationController you have to create a transparent view to hold it. the view will be fullscreen so it does not resize the embedded UITable
I have created a reusable class that fades in a "loading message" and indicator at the foot of the devices screen.
The problem I have is that when I'm adding the loadingview to a view that is contained in a NavigationController I want the view to stay at the bottom of the screen, even when scrolling the tableview.
How can i add a view ABOVE the TableView that is not affected by scrolling and such?
Add it to the view containing the UITableView so that it is a peer to the UITableView rather than a child of it. Generally, this is the UIWindow that your application delegate owns.