Pinterest's first tab is UITableView or UIWebView? - iphone

I wonder which view is used in the next image?
UITableView or UIWebView?
I always wondered how one can tell if a view is embedded inside a web view or not.
Anyway, anyone knows the answer for this specific view?

You can set individual height to individual UITableViewCell using this delegate Method
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;

Related

Custom Section Title View for UITableView

In some apps such as Cool Iris, LiveShare, i see them using custom views for their plain UITableView section titles. Is there a way to replace the standard section title bar with a custom view?
In order to customize the look of your section header, there are two methods you will probably want to use.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
and
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
These are both found in the UITableView delegate protocol. The first will let you create a custom view to display as your section header. The second just makes sure you get the size you want for it so that your view doesn't get cut off

iPhone UIViewController Lag

I have a 'detail' page where I am displaying info for a club. The page is a UIViewController and consists of buttons and labels to acheive this look (like small grouped tables). When I load this page on a device, it lags a bit, more than any other view in my app.
I assume its because I have quite a few objects on the view controller. Does anyone have any suggestions on how to reduce this lag? Or how to achieve the look the 3 smaller tables like this(grouped) in a different way?
Thanks.
SCREENSHOT:
You could try making custom tablecells and use UITableView instead?
You could just make the view a UITableView using UITableViewStyleGrouped style, and then programmatically create the cells for each row. Overriding
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
gets you your titles like "Meeting Information" and "Contact", and overriding
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
gets you correct sizing on each table cell. If the text in "General Information" is not going to be a constant size, you can use the
-sizeWithFont::(UIFont *)font
method of NSString in your heightForRowAtIndexPath implementation.
The issue is not likely your interface design. UI drawing is pretty snappy usually. The things that slow it down are accessing data. If you have a large data set you are searching you might look at ways to speed that up.

Question about iPad/iPhone controls

On the iPhone/iPad in the general settings they have a list of itms that display a '>' at the right hand side. When pressed it slides to another view.
Is this a control from the object palette? If so, which control? If not, what is the best way to achieve similar functionality.
I have looked at a lot of the samples on the Apple Dev site, but I cannot find a control like that, or at least I don't remember seeing it.
Any help on this foolish question is appreciated!! -:)
Thanks
Any time you see a view that is a scrollable list of items, you are looking at a UITableView, and each item in the list is defined using a UITableViewCell. To make the UITableViewCell show the '>', you simply have to set its 'accessoryType' to 'UITableViewCellAccessoryTypeDisclosureIndicator'.
This only draws the '>', it doesn't slide in the other view. However, when a user selects a UITableViewCell, it will call a function on its delegate:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
In here, you will write the logic that slides in the new view controller (using UINavigationController's -pushViewController:animated:).
To learn more about how to use UITableView, I would highly suggest reading through the UITableView programming guide. It also links to downloadable projects with sample code.
You probably mean the combination of a UITableViewController and a UINavigationController. Create a new "navigation based app" to check out how it works & have fun. :)
Both are available in IB under the Controllers section.
The control you're looking for is a UITableview with disclosure indicators. To get the disclosure indicators (either the grey chevrons or the blue buttons), set editingAccessoryType for each tableview cell. That will give you a '>' on the right side of each item in your tableview.
When you tap on one of the '>'s, the tableview's delegate will have this method called:
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
This is different from the method that is called if you tap anywhere else on the row:
- (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
As dominostars said, you create another view and use UIViewController's pushViewController method to have another view slide in from the right.

Look like iPhone inbuilt contact applications image selection

I have created an application in which i have to add users to the sqlite database.
Now the problem is I want the look of the standard iPhone Contact application Where while adding user we have the width of first cell smaller than other cells and the image before that cell..
Can you please give me the idea how such thing is possible.
How to make one cell small and rest others of normal size..
Thanks for any help in advance
There are three UITableViewDelegate messages you can listen for to adjust height
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
However, even thought I didn't write Contacts.app I have a feeling they are also using
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
To adjust the views as well. Remember, you don't have to pack everything into a single monolithic custom table view cell. You can create multiple custom table view cells and load them each appropriately depending on the index path.
The contact detail view is a grouped tableview. Each cluster of cells is a section. The top section is a single custom cell with two subviews that look like squashed tableview cells. The left view shows the contact's photo. The right view shows the name.
To reproduce, create a custom UITableView subclass and lay it out like you want either programmatically or in Interface Builder. Then in the tableview delegate's cellForRowAtIndexPath check indexPath.section and return the proper row for the section.
It appears that the Contacts app uses a custom tableHeaderView when presenting the contact details with an image and label. A similar implementation is included in the sample project iPhoneCoreDataRecipes. The RecipeDetailView loads a separate nib in tableViewHeaderView that is used to set the tableView.tableHeaderView property. Have a look at RecipeDetailViewController.{h,m} and DetailHeaderView.xib. When the Contacts app switches to editing mode, the headerView appears to be swapped out for another view that has a button and a tableView with a single cell. This will allow you to set up a separate tableViewDelegate to handle the Name parts of the contact and a delegate to handle the address / telephony details.

Displaying a UITableView followed by an image, followed by more UITableViewCells

I've seen some applications on the iPhone have an image on top of the tableView, which is straight forward and can be set with something like tableViewHeader.. and a picture below set with tableViewFooter. I recently seen an application where there is an image in the header, a table view, then another image below the footer, and then subsequently a couple UITableViewCells...
Is there a straight forward way to accomplish this without using two UITableViews in the same controller?
Multiple sections will accomplish this, you can also use this method on your UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
in conjunction with a custom UITableView cell created in
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
This will allow you to specify a custom cell with the appropriate height that contains your image.
Use 2 sections.