I was curious if anybody knew the process to create an "add photo" image tile similar to that in the iPhone contacts app. It seems to be on the same level as a UITableViewCell which is shortened (if this is the way it is done).
I've read a suggestion dealing with Headers or custom UITableViewCells but nothing definitive on how it was done. Any illustrative code snippets would be most welcome.
Thank you for any replies.
It's just a UIButton added to a UITableViewCell. You can simply use the addSubview method of the UITableViewCell to add a button to the cell.
It is a header. Most of the functionality is in the 'HeaderFooter' example from the apple developer site. In that example they use a UIImageView for the photo area, but you can implement it with a UIButton instead. If you do this, just set the text to 'Add Photo' when desired, with a blue bold font of about size 12. If you want to leave it as an imageView, you'll have to put a subview with the text on top of it.
The name part can easily be recreated with a UIButton with a PNG image of a detail disclosure icon set as the button Image. It really looks like a small UITabelViewCell.
If you really want you can use a tiny UITableViewCell instead of the PNG for to render the detail disclosure icon, but that's a heavier, more kludgy solution.
Related
I added a UIToolBar from Interface builder, then dragged 2 UIBarButtonItem's. Now i need to add an image to it. So i selected the barButtonItem and selected the image using Interfacebuilder.
I only get a White image, with no curvy edge. My image is as follows. I don't see that image, but instead i see a white rectangle.
How do i prevent this. Can someone tell me whats wrong, and provide me with a working solution.
my bar button
If you go to iOS Human Interface Guidelines you will see the specifications for icons and buttons. This is my experience, for the best result you'd better create a specific icon (image) for UIBarButtonItem. If you still want to use an image, that doesn't follow the UIBarButtonItem guide, my approach is:
Add a generic UIButton instance to your view. Drag it from the list on the right to the view, not to the ToolBar or navBar.
Customize it with the image, i.e. from the Inspector, set the image or background image, or set it to custom style, bordered, etc.
Drag it to the toolBar, and XCode will adjust it. Again, it does not always guarantee the best result, but it does what you want.
I hope it helps.
You should drag an "Image View" on to your layout and specify the image in that - that worked for me, but I'm no xcode guru.
Hope that helps, Paul
I'd like to replicate the iOS 4.x ABNewPersonViewController UI layout (see link text) in a custom view but I'm unsure about the best way to achieve this. I was thinking of a single grouped UITableView, but what about the first section? How do I achieve the smaller cells (first,last,company)? And finally the "add photo canvas" is it just a sub UIView with a background image for the shadow and the rounded border or can this be done programmatically?
Many thanks in advance!
your idea about a single grouped UITableView could work. The way to get the smaller cells as well as the photo cell would be to subclass UITableViewCell and create it like that. and yes the photo canvus is just a custom UIView added on top of the UITableView. I'm not sure i see the point of rolling your own here, but thats how i'd start. Also i think i recall seeing a tutorial on how to build this page..try googling for it.
During a time in my app - I make a button a button not enabled
myButton.enabled = NO;
The problem is that I've made my button in IB with an image, and just a UILabel overtop of it.
The label does not grey out when the buttons does.
In IB - is there a way to link the label to the button?
This is not possible without you doing the linking action yourself, as #Eiko rightly pointed out.
It sounds like you need to make your image the background-image of the button, so you can have your label as the button text, like it is intended to be used. Then you can specify colors, fonts & images for all 4 possible states.
If you decide to invent the wheel yourself, by keeping button and label as separate objects, you will have to invent everything around it as well.
You can add another outlet in your code, i.e. IBOutlet UILabel *yourLabel;
Then link this outlet to your label, same procedure as linking the button.
I would like to have formatted, clickable text and images inside a selected UITableViewCell. An example of the functionality I'm looking for can be seen in the iPhone Twitterrific app. When the user clicks on a cell, the cell is highlighted and the various links become highlighted and clickable.
I've seen the idea of using a UIWebView inside a UITableViewCell to handle formatting, but I'm unsure about this. Does that mean that every cell has to have it's own web view? I'm wondering about the expense and performance of such a method. Is there another way to get this functionality using Core Graphics?
I'm using custom drawing currently to draw my table view cells as described in atebit's blog post on fast scrolling.
Craig Hockenberry, author of Twitterrific, blogged about how he did that back in 2008:
http://furbo.org/2008/10/07/fancy-uilabels/
Basically, when the row is selected, he overlays UIButtons where the links are. It's imperfect, as sometimes the button won't fit in the same place the text does.
The first thing I would do is to checkout twitterific's old source code. And see if that version does what you are looking for.
I'm not sure how Hockenberry does it, but generally UIWebviews + UITableViewCells != fast scrolling.
My guess is that each cell does NOT contain a UIWebview until you click in it, when he quickly places a UIWebview in the cell to handle the text formatting. You then have a reusable UIWebview instance that you reuse but just change the content of repeatedly.
Does anyone know how to implement an action badge, like the ones seen below with the price tags in them. The App Store has those too.
alt text http://m.macupdate.com/images/screens/uploaded/30815_scr.png
The easiest way is to set the accessoryView of a standard UITableViewCell to a UIView. You can just make them be standard UIButtons, set their background color and the label color and font.
If they're not meant to be interactive, then you can use a container UIView with a UIImageView in the background and a UILabel in the front added as subviews.
If you want to get fancy with it you'll have to subclass UITableViewCell and lay out the various bits yourself. It's not that difficult. The TableViewSuite sample code shows you how.
I am not sure there is anyway within the framework to create this type of button. You could fairly easily simulate it using your own custom images. What you want in this case is a stretchable image that does not distort as you resize the buttons.
Take a look at the following method on the UIImage class:
- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight