UITableViewCell showsReorderControl
@property(nonatomic) BOOL showsReorderControl
Discussion of [UITableViewCell showsReorderControl]
The reordering control is gray, multiple horizontal bar control on the right side of the cell. Users can drag this control to reorder the cell within the table. The default value is NO. If the value is YES , the reordering control temporarily replaces any accessory view.
For the reordering control to appear, you must not only set this property but implement the UITableViewDataSource method tableView:moveRowAtIndexPath:toIndexPath:. In addition, if the data source implements tableView:canMoveRowAtIndexPath: to return NO, the reordering control does not appear in that designated row.
UITableViewCell showsReorderControl example.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView1 dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
cell.showsReorderControl = YES; // to show reordering control
}
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView1 dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
cell.showsReorderControl = YES; // to show reordering control
}
Example of [UITableViewCell showsReorderControl].
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"do not leak me"];
if (!cell) {
cell = [[UITableViewCell alloc] init];
cell.showsReorderControl = YES;
}
cell.textLabel.text = [things objectAtIndex:indexPath.row];
return cell;
}
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"do not leak me"];
if (!cell) {
cell = [[UITableViewCell alloc] init];
cell.showsReorderControl = YES;
}
cell.textLabel.text = [things objectAtIndex:indexPath.row];
return cell;
}
UITableViewCell showsReorderControl example.
- (UITableViewCell *)tableView:(UITableView *)tableview cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableview dequeueReusableCellWithIdentifier:kCellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:kCellIdentifier] autorelease];
}
// get the view controller's info dictionary based on the indexPath's row
NSDictionary* item = [allSounds objectAtIndex:indexPath.row];
cell.text = [item objectForKey:@\"toneName\"];
cell.showsReorderControl = YES;
return cell;
}
UITableViewCell *cell = [tableview dequeueReusableCellWithIdentifier:kCellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:kCellIdentifier] autorelease];
}
// get the view controller's info dictionary based on the indexPath's row
NSDictionary* item = [allSounds objectAtIndex:indexPath.row];
cell.text = [item objectForKey:@\"toneName\"];
cell.showsReorderControl = YES;
return cell;
}