I have a UITextView embedded in each cell of my UITableView. Clicking the cell calls another view controller but clicking the textview inside the cell doesn't (but I want it to). How can I fix this?
Uncheck User Interaction Enabled in the storyboard under the View category of the Attributes Inspector for your UITextView.
Related
I have a UITableViewController. Each cell in the table has a segue to present another UIView modally.
When I click on a cell in the UITableView, it brings up the other UIView.
But I put the UITableViewController in a Navigation Controller, nothing happens on the first click to the cell, and the UIView shows up on the second click.
Does anyone know why putting the UITableViewController in a Navigation Controller cause the first click to do nothing?
EDIT:
It seems that the focus is not initially on the table view. When I first click the cell, the focus on the tableview, and the second click goes to the cell.
I used storyboard.
Here're some screenshots:
This is the setup of the views
This is how the table cell is connected to second view controller
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 UITableView loading cells from a nib. On each table view cell, there are two buttons. When the button is tapped, I need to update other fields in the view that contains the table view.
In the past I've used a delegate on the table view cell to call back to the view controller to tell it that which button was tapped and used tags on the cell to find the cell's index. The problem I'm currently facing is that this sort of behavior happens in multiple places throughout my application and delegate patterns everywhere could get messy quick.
Is there a better method to message the tableview's parent view controller when a button on a specific cell has been tapped? I need to know which cell was tapped and which button on the cell was tapped.
Yeah, the better method is to make your controller the target of the button's action method. You'll still need to use tags to get the index path of the cell the button was in. You can hook up the action method in IB, or in cellForRowAtIndexPath.
Looking for some guidance.
In my main window nib file, i have a tab controller where each tab control item is being loaded by a separate nib file and controller. One of the tab items is being loaded by a navigation controller.
Looks like this (excuse me for not including screenshot)
MainWindow.xib
Windows
UITabBarController
UITabBar
UINavigationController (loaded from Test.xib file)
TabBar Item
Test.xib
View
Now I like to add a scrollable text in the Test.xib. So that when the user clicks on the tab item, my Test view opens up with some text that the user can scroll.
Do I need to add a UITextView as a child of my View in Test.xib ?
Do I need to add a UIScrollableView ? And how would I connect them all so that I can manage the text.
If you add an UITextView to your view, connect it to a proper Outlet in your controller, than you can manipulate the text with setText:. The scrolling behaviour is added automatically.
Yes, UITextView needs to be a child of your View in Test.xib (you can add it programatically if you like or through IB). You do not need a UIScrollableView. The textview will scroll as long as you set scrollEnabled = YES;
Not sure what you mean by "how would I connect them so I can manage the text". You can send the UITextView a message of setText to whatever text you want in there. Hope that helps some!
i'm having a tableview nib file.(contains a list)
i want to add some buttons with it
so i want to change the tableview to view and put the tableview inside that view
then add buttons to the view..
what to change in the class files and how to do this?
if you want to change the tableview to view, you can do in the IBOutlet.
By changing the value in the Inspector Identity from UITableView to view. So that it will change to view and you can add buttons and some to that view.
or else you can add the buttons with out changing the IBOutlet with code.
you can change the UITableView frame and you can add buttons to the view.
Regards,
Satya