Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Is it possible to have the following?
When I rotate my iOS Device, the ViewController switches, as in I have RandomViewControllerPortrait and RandomViewControllerLandscape. I have the feeling that if I support both orientations, that the ViewController class gets quite "bloated".
Is this idea useful at all?
I think having 2 view controllers for different rotations would be a bit redundant. I think what you want to use is 2 different UIViews for different orientations, and your UIViewController handling the methods for rotations being called. When your application rotates, you can set self.view to be either portraitView or landscapeView. You can even animate the view change with an animation block, so the transition looks smoother.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have already tried to implement UISwitch in the tabeleview cell,now the switch state is automatically changed while i scroll and change the view ,
Please guide me....
You can use NSMutableDictionary for holding the information regarding particular cell UISwitch object. If you have enable a UISwitch button for a cell then set Bool yes and tag value as well in the NSMutableDictionary.
Enable the switch for a particular cell object according to NSMutableDictionary values in cellFor rowAtIndexPath.
UITableview reuses the cells, to solve your problem you need to create NSArray for switch states and assign as user scroll up and down (Using NSIndexPath).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a view with several UIButton instances. Now I'd like that the user can trigger als button when he wishes over it with a long touch. So he can either touch one button or wishe over several buttons. Therefore all button actions of the touched buttons should be executed.
Here's a photo (buttons with red background color and black border):
Thanks for your help!
Best regards from Bavaria,
Chris
If I understand the question right, what you need with your grid of buttons is UIPanGestureRecognizer.
You can add the same recognizer to every instance of UIButton and handle all its states (UIGestureRecognizerStateBegan, UIGestureRecognizerStateChanged, UIGestureRecognizerStateEnded).
If you want certain delay in detection (like UILongPressGestureRecognizer), you can trigger timer and check if finger is still inside the UIButton's frame.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Requirement of my app is to have UINavigationController at the bottom with play, rewind and stop buttons on it. Play button will play audio and will have multiple ViewControllers. what should be the code to display UINavigationController at the bottom
UINavigationController should generally go at the top of the view (as per the H.I.G.).
A bar at the bottom should be a UIToolbar where you create your own buttons (UIBarButtonItem) and give them to the toolbar.
UIBarButtonItem has default items for Play, Stop, and Rewind (and many others)
If you already use a navigation controller, you can show its default toolbar (setToolbarHidden:NO) and create/set the items in the same way.
UINavigationController is a container that maintains a stack of UIViewControllers and a NavigationBar. You could try using the UINavigationBar separate, but you'd likely be better off just making some custom graphics on an imageView at the bottom.
Got it with the frame definition display it at the bottom like
MyCustomNavigationBar *navigationBar = [[MyCustomNavigationBar alloc] initWithFrame:CGRectMake(0, 435, 320, 25)];
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
while i am scrolling my table view gets moving upwards ..
i hav created table view programmatically without using IB so i should able to fix the position of table view while scrolling also...
how to do this..
any suggestions appreciated..
Do you mean you dont want the table to scroll at all? If so then this should do it.
tableView.scrollEnabled = NO;
Are you embedding a UITableView in a UIScrollView? It sounds like it. Don't. UITableView is already a subclass of UIScrollView and supports scrolling on its own.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
UITableView is a very powerful class, powering many navigation and preference views on iPhone. Many people have come up with useful UITableView tips, tricks and samples:
various ways to use Interface Builder for table cells
how to create preference-style cells
ensuring good scrolling speed
etc.
Please post your favourite tips on using UITableView, one tip per question. I'll start by posting the ones I found on Stack Overflow and the ones from my bookmarks.
Ever wondered what UITableViewController really does?
In viewWillAppear, it deselects any selected rows, with animated:YES.
This by the way is why when you navigate back in UINavigationController, the row you've previously touched is nicely deselected with animation. When you pushed a new view controller onto UINavigationController, you've left the row selected. When you pop it and go back to the table view, viewWillAppear fires and deselects the row. UINavigationController does not even know about this happening.
In viewWillAppear, it calls reloadData if the table view contains no rows.
In viewDidAppear, it calls flashScrollIndicators.
It monitors the keyboard appearing and disappearing and resizes the table view appropriately so that when you tap a text field in a table view, it remains visible after the keyboard appears.
If you don't need the keyboard monitoring behaviour, it is fairly easy to do everything else yourself if you need to.
Implementing “checkmarks” in editing mode to manipulate several rows at once: “Multiple row selection and editing in a UITableView” from the great Cocoa With Love blog.
How to implement a custom cell background view?
An excellent sample class by Mike Akers in “How to customize the background/border colors of a grouped table view?” on Stack Overflow.
If you want to remove the separator lines, use this:
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
To ensure good performance scrolling, it's important to avoid transparency in any element if possible - so if you are creating custom cells make them all opaque and set the backgrounds correctly.
You can use the Core Animation Performance Tool to visually see how much transparency you have going on in a cell - you have to be running on the device to use this tool.
Implementing Preferences-style grouped tables: Three20 library (extracted from Facebook iPhone app) has a set of ready-made cells that contain various controls.
(Not sure you want to use them, however. Three20 suffers from “not-invented-here” a little bit and tries to subclass and extend everything, so adding it adds quite a bit of a mess to your project. But at least you can use it as an example.)
How to use Interface Builder to author your cells? Find answers on a separate Stack Overflow discussion: “Using Interface Builder for UITableView’s”