How to "attach" a UITableViewCell to a TextView? - ios

I'm looking to make something like the To: field in Apples Mail app. Basically I want a UITableViewCell to stick to the top of a TextView. Actually it is not a necessity that it be a UITableViewCell, as long as I can stick a label, a text field and a button to the top, just as in the Mail composer.
I've tried to put these things on a scroll view, but couldn't figure that out.
Any help is appreciated :)
PS. I know of Three20, but I would much more like to figure out how to make this To: field lookalike myself, with my own code and no dependencies.

I would do this in a table view and the view in the footer of the table view.

Related

Customize cell layouts programmatically

I followed a tutorial on how to make a UICollectionView and my cells looked like this:
My question is how can I customize them as I want? By code, since I want to do everything with code, I would appreciate any help, links, or anything to understand everything about how to customize items and cells.

iOS: Make content (text) in table view cell editable, but only in edit mode

I know this has been asked a lot of times but theres so much different information and different cases, I just don't understand where to begin and cannot get it working in my app.
In my app I have a table view and I'm using a NSFetchedResultsController. In normal mode, the table cells shouldn't be editable but instead each click should be a segue to a new viewcontroller (which works). In edit mode however I want that if you click on the cell, that you edit the text and this gets automatically stored to the database. And here I don't have a clue.
I want it as simple as possible. What I've read so far I guess I have to subclass UITableViewCell and a TextField. Here's already my first question: In each post about this, the TextField is init with a Rect, however how do I know the exact width and height of my cells?
And do I add this cell directly in the cellForRowAtIndexPath? Or only if the mode gets changed to edit? And some posts suggest you have to be the delegate for UITextField, but why?
And is there some sample code for about exact the problem I have? I wasn't able to find it...

Adding UITableViewCell with a UITextField upon pressing a UIBarButtonItem

I am very new to IOS development and Objective-C as i have just come from a mostly Java background. I have quite frankly searched everywhere on the web to find the answer to my question but nobody as it seems can give a clear concise answer on how to do this so anything would be VERY much appreciated!
So here is what i am trying to do. I have a UITableView and a UIToolBar below it with a UIBarButtonItem. What i want to do is be able to press the BarButtonItem and then have a new TableViewCell with a text field in it be created and placed at the top of the TableView that has a unique tag so that i can parse through the text fields later and retrieve the text to store into a mutable array.
Any help would be really awesome so thank you in advance, i would really like to get this working! If you have any questions on the code i have or more details on what i am asking please ask away!
Well there are plenty of resources on how to add TableViews, Toolbars, etc... Here's an overview of what you'll want to do.
In your ViewController's view, add a UITableView to it, but remember you want to leave space in your ViewController's view for the toolbar at the bottom of the screen. So set the tableView.frame accordingly.
Look up how to add a UIToolbar (http://stackoverflow.com/a/7712240/1457445 is a good start)
Then how to add a UIBarButtonItem (http://stackoverflow.com/questions/5383906/how-to-add-uibarbuttonitem-in-uitoolbar-in-code)
As for adding the textView in the UITableViewCell, you simply call [tableView.contentView addSubview:yourTextView];
Again, there is plenty of help out there for customizing UITableViewCells (http://stackoverflow.com/questions/4238760/how-to-make-a-uitableviewcell-with-a-uitextview-inside-that-dynamically-adjust)
And to top it off, you'll need to figure out how to add the textview cell to the table - another great SO post (http://stackoverflow.com/questions/5824998/uitableview-adding-cells-dynamically)
The simplest way is put your UITextField on UITableView header when UIToolbar button item touched. The simplest way is put your UITextField on UITableView header when UIToolbar button item touched. After user done on UITextField then update your NSMutableArray reload data of UITableView and remove header on UITableView.

How to make more use of the separator line? E.g. making it a cell?

I was wondering, how you could do something like this, e.g. make the separator line usable, in this example as a display of votes. I think the separator line is a cell here. When you click on it a popover menu comes and you can click what you want to vote for. My question is: Does someone know how to do that or has a link to a useful explanation?
I don't think that the "seperators" are actual cells, but rather part of the previous cell. You can see that the indicatorview is seemingly not centered vertically (which I personally even find sloppy).
So, just make a custom cell with your desired behavior. Maybe google for "Accordeon cell" or something like that, I think I remember they talked about cells like that in the previous WWDCs.

implementing uitabbar to uitableview

I want to put a uitabbar into a section in uitableview, I have hard time looking a way for it, since I just started doing XCODE in less than a month. Anyone there know the solution for it? Any help is appreciated, and if possible, could you share a link for the tutorial or examples as well. Thanx in advance.
You can't do it in this way. They both are different things but you can have UITableView inside the uitabbar view. But vica-versa is not allowed ...this is not feasible and also not proper as per apple's guideline. So, please make sure not to use in this way...rather go for some other alternative :
like put Custom UIToolBar in header of tableView , having look & feels like Tabbar.
You cannot put a tab bar into a tableview.
I you want to use a tab bar, use it as a sub view of a UIView.
The UITabBar is supposed to contain other views. So no, you cannot add it to your table view. To get the look and feel of the Groupon app, there are two things you could do:
1. Create a custom tableviecell as advised above.
2. Since the toolbar (which looks like a tabbar) is outside the actual table, you can have it as a separate view and reduce the size of the table to accommodate it. Or add the toolbar to the footer view of the table.

Resources