iPhone: Lock the UITableView and ControllerView
I have been using UITableView and UIContr开发者_如何学运维oller in every screen of my application. It is simple game application where I have every screen full of particular image at particular stage and hot area to enable the object selection. The most annoying part is even entire View has fill up with image, I am able to drag it up and down which shows me blank screen. I want it to lock it so that nothing should happen when you try to drag it. Could anyone please help me out here.
Thanks.
Have you tried setting the scrollEnabled
property to NO?
You can access it through the tableView
property of your UITableViewController
.
Preferred place where you can set it: -viewDidLoad
.
You need to get the coordinates of the touched point as screen coordinates. Then for each frame, compare these against the frame of the view you want the user to remain in.
You can use the function calls below to number crunch this for you:
CGRectGetMinX
CGRectGetMaxX
// etc... applies to Y-axis too
Check the CGGeometry class reference.
Did you use a UITableViewController
?
If you do so, there is – tableView:canMoveRowAtIndexPath
: in the UITableViewDataSource
Protocol.
Hope this helps...
精彩评论