Two cell in a row,UITableview - iphone

I want to have a two cell in a row,as in contacts we have “Text message” and “Add to favourites” in a single row how to do that….
Is that Splitting a cell into two?
can anyone help me?

For that you're going to have to create your own custom cell which contains two cells. Perhaps the easiest way to do that would be to create a cell which contains two buttons. It's somewhat a hack, but it's the easiest way.
If you go with that route, you won't even have to subclass, you can simply prepare your content view with the two buttons, and set that as the cell's content.

Related

How can I style a cell or row/column of cells in NatTable programatically?

I'm having a hard time figuring out how to individually style a cell or group of cells when a certain thing happens. For instance I would like to be able to right-click on a cell and hit something like "tag" and it would change the background color of the cell to something different. I would like to do the same thing with rows, columns, or any random group of selected cells. I also need this change in style to persist even if the cell(s) are moved beyond the viewport layer's view.
If you have a hard time with NatTable, maybe it is worth reading some of our tutorials and documents.
https://www.eclipse.org/nattable/documentation.php?page=styling
http://www.vogella.com/tutorials/NatTable/article.html
In short related to your question. Individual styling is done via config labels on a cell and styles that are registered in the ConfigRegistry for that label. So what you need to do is to implement some sort of label registry based on cell indeces. That label registry then needs to be used by a custom ConfigLabelAccumulator so the labels are attached to the cells with the corresponding indeces.
We have a basic implementation on a column base via the ColumnStyleEditorDialog. This can be seen in the _000_Styled_grid example by clicking on the column header and call "Format cells". Personally I think that feature is not complete, but it should help you in seeing how it works in principle.

constant tableviewcell at the beginning of the tableview

I would like to know if there is any sneaky way of getting a UITableViewCell to appear at the beginning of a UITableView no matter what the array that is going to populate the tableview contains?
I am having issues where I would like to have a "select all" cell at the top of the tableview but currently having issues trying to adjust the arrays I have going into the tableView:cellForRowAtIndexPath:
Not sure of your end goal, but there are many ways some easier (sneaky ways) than others depending on your needs. It sounds like your items are fairly static, so you can just insert them before you display or update the table row.
say you have a datasource called self.items and you did something to get data. Maybe in your app you are round tripping to some data source based upon input, like sort selectors or from the search bar delegate.
try something like this in the area where you load your datasource.
NSString *myCustomObject = #"Jump To Songs";
self.items = [self getGetMovieList];
[self.items insertObject:myCustomObject atIndex:0];
[self.tableView reloadData];
Another easy way would be to add sections to your table and just make the first section your navigation items.
Note: you may need to handle the actions in didSelectRowAtIndexPath......
there you go, not so sneaky, but pretty simple.
be well
You can make two types of UITableViewCell, then return the "select all" one if indexPath.row == 0.
On the other hand, how about just make a UIView for the "select all" functionality, and set it as the tableHeaderView of your table view?

do I need separate UILabel in a custom UIView to have separate UILabel lines in a UITableViewCell?

do I need separate UILabel in a custom UIView to have separate UILabel lines in a UITableViewCell?
That is, if I want to have a TableViewCell that has all text, but the text needs to contain 4 separate rows for 4 separate strings (e.g. Name, Title, Description, Location), and each these separate rows could include a wrap around.
To ask the question the other way around, is there way with a normal UITableViewCell using it content view and single text label, to force Carriage Return/New Line points at the end of each of the four strings? Oh yes, and the cell height will need to be calculated for each Cell as it may vary (just in case this is significant)
The answer to the last question: NO. (Answer to the title: YES.)
You can build a cell in its own NIB file. An exercise I suggest if you've never done it.
Layout the size/location/resize functionality as you like it.
your table view controller can be the owner of the file,
add an outlet to the TV controller of loadedCell, and call load nib
every time you want to alloc a new cell,
i suggest tagging each of the cell labels, and accessing them
that way, and setting the loadedCell value to nil after loading it,
p.s. a UILabel often wraps text undesirably, or is hard to layout in a cell to look good, consider the other values of lineBreakMode for your labels
p.p.s. it will employ a text shortening behavior depending on adjustsFontSizeToFitWidth and minimumFontSize (taking this and lineBreakMode into consideration)

Is it possible to link a table cell

I wonder if it is possible to link a table cell in a tableview.
I have a tableview with two sections. The first section hold some address data in six cells and the second section has only one cell and this should call the google maps app when clicked. Is something like this possible and how does it work?
In didSelectRowForIndexPath filter on indexPath.section and indexPath.row. indexPath.section should be 1 (=second section) and indexpath.row should be 0 (=first row).
If both match you trigger the required action.
#crazer yes it is possible to link a custom table cell in your UITableView.....if i understant your problem well u need to print different data in two setions through custom table cell......that u will do through the conditions .......but u have to subclass UITableViewCell. For further information please follow the link (Table View Cells - Subclassing UITableViewCell).....http://www.bogotobogo.com/XcodeSDK-Chapter7B.html
Hope u got my point!! Good Luck

Best (Any) way blend tableview section header onto top of a grouped tableview

I'd like to add section headers to my grouped table view's sections but I'd like them to appear seamless (see image). The default, as we're all well aware of, is rounded top corners on the first row of a grouped table view cell so it ends up looking like crap when you merge them.
Any way to specify when indexPath.row = 0 that the UITableViewCell should use row style "middle" or something like that?
If not then what are my options? I guess I could scratch the section header and use Row 0 as a quasi-header then push my array data +1 to fill the rest of the table? I'd rather not roll my own from scratch...if possible.
Sample Table http://img35.imageshack.us/img35/8181/sampletable.png
Edit:
"Crap" looks like this:
alt text http://img25.imageshack.us/img25/9748/crapsection.png
Don't do what you're doing, it's against HIG
Ok, ok, I'll tell you how to do it:
You're going to want to do your own cell background views. The default grouped one is not what you want.
When a tableview asks you for a cell, set its backgroundView and selectedBackgroundView to something that looks appropriate for its place in the tableview.
Usually, this means a UIImageView with the appropriate image, though you can go wild here with a custom view, but there are gotchas.
So in your case, you would do
if (indexPath.row > sectionRowCount - 1) {
//Not the last row
//Put in the middle background
} else {
//Put in the end background
}
Then you'll want a custom table section header, but that's pretty easy.
In your case, you probably won't have to worry about when there's just one row, so that makes things even easier.
Take a look at the tutorial here:
cocoa with love basically what you need is 3 different images. One for the top row, one for the bottom, and a 3rd for the middle rows.
You could also not use the section header, but instead use a custom cell as the first cell of the section. So when ([indexPath row] == 0), return a custom cell that is the "header" and then return the "regular" cells (offset by one row) for the rest. You'll also have to make adjustments to the numberOfRowsInSection function to return +1.