every iPhone and iPod Touch has got the Apple "Addresses" App ... when you create a new record, there is a tableview. The first line contains an button (to add an image) and a tableview cell.
How would I do such a tableview cell with a button and a regular cell in one row ?
Thanks a lot !
Sebastian
It's not a button and a regular cell. It's one custom cell with two custom subviews the second of which is made to look like a standard tableview cell.
Just make a tableview cell that looks like you want (either in interface builder or programmatically) and return it as the cell for section 0, row 0.
Related
I am working on a app which includes table cells. I want that when i swipe table cell it shows two options, first about that cell value and another for delete that value. How can i show that in a way that the cell value shows in half of cell and the options show in half of cell.
Thanks in advance.
There are an out of the box solution, called HHPanningTableViewCell. It does exactly what you need!
HHPanningTableViewCell is a UITableViewCell implementing "swipe to reveal" a drawer view. Such a view typically holds action buttons applying to the current row.
This library, SWTableViewCell, should help you:
https://github.com/CEWendel/SWTableViewCell
An easy-to-use UITableViewCell subclass that implements a swipeable content view which exposes utility buttons (similar to iOS 7 Mail Application)
You have to create a custom cell and override Apple's behavior which is swipe left to delete and then show your options. You can add gesture recognizer to the cell and on swipe to left animate the cell content view and animate in your option view or however you like it to be. I can write up an example code if you need.
I am working on a app where I want to expand a tableviewcell to cover almost all the screen with animation when it is selected by user. I am looking to create a uiview on the tableviewcell and expend it to cover major portion of the screen when user selects the row.
The main problem I am having is to get the frame from where my pop up view will start expending. How will I get the frame of the row which is touched?
Thanks
Pankaj
Is it crucial that the cell should not reposition?
If not ( i am guessing not, as you are anyway planning to cover whole screen):
When the cell is selected, scroll the cell to top (using scrollToRowAtIndexPath) and either insert your custom view to cell's contentView or modify its parameters if its already there with different opacity/size etc
Use UITableView function to get the rect for the row by passing the its NSIndexPath.
- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath
I want to add my customized tableviewcell in my tableview when user selects a cell I have some buttons on that customized cell and want to give user option as soon he selects a cell.
Any suggestions and guidance to move on from here?
you have to use customize cell when cell is created and change the image of the cell when it will selected.
Create two custom cells, one for the normal rows and other for the required row. When the user touches a particular cell, you can record it's indexPath and reload the tableView. When the cellForRowAtIndexPath is called the second time after tableView reload, you can identify the row with the flag set earlier. You can then create a new cell for it.
I have a custom table cell having a uiview and 3 labels. on the uiview there is an imageview. i am detecting touch and on the uiview/imageview. on touchesended method i am changing the image of the imageview on this uiview.now after running the program 7 rows are visible on the table. if i touch on the imageview of 1st row, the image gets changed. Now if i scroll the table, the image of the imageview on row 9th also gets changed itself. Can any one pls help me out whats getting wrong?
if you use reusable cells, after scrolling the table view will consume the same cells you've set up in the cellForRowAtIndexPath method. So it might be that the cell for row 1 and for row 9 use the same cell object. That explains, that when you change something in row 1 cell, the row 9 cell will be changed in the same way. Just be sure, that when you setup your reusable cells to nil the image of your uiimageview, or feed it with a proper image.
I haved tried to create a view with a UIButton and a tableView Cell,
then I set the header view to be this view.
However,the cell in the header is not rounded-rect, besides,how to handle the cell's event,when user click this cell.
I haved tried to use custom cell also, but how to create a button and a shorter cell in a row?
when you select the cell,will not affect the button state?
thanks.
You can fake this in a number of ways. The simplest is to layout a rounded rectangle UIButton in your header, and turn off userInteraction for it so that it's just decorative.