Left area of section in iPhone TableView - iphone

I have a section where I would like to customize the left area of a section a TableView - a bit like viewForHeaderInSection.
I have thought at using a cell for the section instead, but it would be a lot of nitty-gritty.

If I understand your question correctly, you want to customise the left-hand-side of some, or every cell in a UITableView? Then you need to make create your own custom table view cells. I normally make these cells in Interface Builder; this post helped me out. See also the Customizing Cells section of Apple's Table View Programming Guide for iOS.

I read your question to mean that there is one custom element to the left of a bunch of cells. The only way I know of offhand is to use a cell as you describe and then have a left view and a tableview inside of it.

Related

Search bar displaying beneath table - swift storyboard

Seems like a pretty basic issue, but I have a tableViewController and at the top of the screen I've got a collection, beneath this I want to include a Search Bar. But for some reason it won't let me place this above the Table View Cell. It will let me add it into the collection view bizarrely but it goes behind the cells.
Is this a limitation caused by the fact I've included a Collection at the top of the screen? Is there only space for one element above a table on a tableViewController? Is there a workaround whilst still using a tableViewController?
Likely a noob question, but I'm still v noob
Is there only space for one element above a table on a
tableViewController?
Correct.
You get one header view area, and one footer view area for the tableViewController as a whole. (plus extras for the sections)
If you want a quick solution for a simple table then the tableViewController saves you about 60 seconds. - but if you want to do something more complex now or later, then you may want to consider using a regular UIViewController, dropping a UITableView into it and applying constraints as needed.
You would also need to remember to set the tableView dataSource and delegate up and comply to their protocols - or you go the diffableDataSource route.
Thanks #agentoverflow I couldn't find any documentation that explained the limitations of a UITableViewController.
Came up with my own solution. Put a view into the header area and put my collectionView and searchBar into that. Hooked the code up for both elements and both are working as expected.

Where do I start to create a "Contact Info" page/table?

I want to create a view in my app where the user can contact me. At first glance I can see it's a grouped table view, but I'm unsure about the top part?
How do I get the Logo/Thumbnail there along side the big text and small text?
- I'm assuming it's a custom tableview cell?
Also, what about adding the buttons into a table cell? all evenly spaced apart? Would this also be through a custom table view cell? (designed in IB)
One last thing, is how would I put these two cells in with the rest?
My guess is that the green image and the three buttons on top (call, email, visit website) are all subviews of the table's header view. You can easily do that, if you go to Interface Builder and drag a UIView to the top part of your UITableView.
Then, you will need custom cells for the next part of the interface. One easy way is to make them all in IB and then create outlets and hook them to your table. Read the Table View Programming Guide for iOS regarding more alternatives for custom cells. If you need more customization, start from this excellent article. Finally, regarding the bluish rounded background of number "20", have a look at this SO question. Good luck!

iPhone Recent Calls Details View - Custom Cell?

I would like to have something that would kind of replicate the details view of the recent calls tab on the iPhone phone.app.
When viewing the recent calls, tapping the disclosure button takes me to the view pictured here: http://img337.imageshack.us/img337/3456/recentcalls.jpg
I would like to know if that area in blue represents a custom cell. Am I right? Or is there an easier way to accomplish this?
My need for replicating this comes from my trouble with heightForRowAtIndexPath, as explained here: heightForRowAtIndexPath for only one section?
(I won't be using heightForRowAtIndexPath anymore with this solution).
Thanks in advance.
It looks like the area you've outlined in blue is the section header for the first section. You could also just use the table header.
Matt Gallagher posted a nice article on customizing your table header.
If I had to guess, it is likely a custom section header view, glued together from various labels and other widgets.
It would certainly seem much, much easier IMO to do this with a custom table view header view than with a custom table view cell.
See the table view delegate method -tableView:viewForHeaderInSection: where you return your custom UIView object for a given section.

iPhone app - some custom UITableViewCell questions

At the moment, I have a settings view in my iPhone app built with Interface builder, it consists of a background image, some text fields, labels and buttons. Because this looks bad, I want to convert the settings view to an UITableView with custom UITableViewCells.
I already tried adding some cells into my settings view's XIB and returning them in the cellForRowAtIndexPath method (with [return myCell];), as written in Apple's tutorial, but this was not working for me - my whole TableView looked strange and it only showed the first cell correctly.
Is it possible to design these custom cells in Interface Builder? Do I have to create an empty XIB for them or can I put them in my view's XIB? And how do I insert them into my TableView?
Thanks in advance,
Yassin
You can absolutely add custom table cells that you built in interface builder. This includes both static cells and Dynamic cells. However without you providing more information the best I can say is "double check the docs and try again." I can only say that it works and it's rather straightforward so it's hard to say what you may have missed. It might be more helpful if you post what you have for the tableView:cellForRowAtIndexPath method.
Since you say you just have some text fields, I would recommend looking at the technique for static row content section of the Table View Programming guide. You probably would want to have each field of your form correspond to a row in a Segmented Table View, it'll make everything look nicer.

How to add UITableViewCellAccessoryCheckmark in the middle of the cell in iphone?

In my iPhone application I have used (UITableViewCellAccessoryCheckmark) to add the checkmarks in the cells, - it is added to the cell at the right side of the cell.
I want the checkmarks to display in the middle of the cell and after that a string should display. So that the user can set the cell item as checked or unchecked.
Please provide any solution or any code for adding the (UITableViewCellAccessoryCheckmark) in the middle of the cell.
There is no built in way to do this. You will have to create a cell, then in tableView:cellForRowAtIndexPath: you will need to either add a custom subview, or return a custom cell and tell it to display the custom checkmark you added based on the data state.
The accessory view of the cell is always on the right side, outside of the cell's content view (see the Table View Programming Guide for more on this). If you want to do something like this, you really need to create your own cell class, and draw the checks yourself.
Speaking as a user, this design seems sort of confusing, and definitely not what I'd expect. What's the string you're displaying to the right of the check? Maybe something like the UITableViewCellStyleValue1 style cell would work, instead? (See Standard Styles for Table-View Cells for more.)