2013-10-15 34 views

回答

1

里面SBTableAlert.m找到如下:

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 

在那里,你可以只包括这和你的背景颜色会被改变:

//Example with a predefined color 
UIView *bgColorView = [[UIView alloc] init]; 
[bgColorView setBackgroundColor:[UIColor redColor]]; 
[self setSelectedBackgroundView:bgColorView]; 

//Example with an RGB color 
UIView *bgColorView = [[UIView alloc] init]; 
[bgColorView setBackgroundColor:[UIColor colorWithRed:155.0f/255.0f green:155.0f/255.0f blue:155.0f/255.0f alpha:1.0f]]; 
[self setSelectedBackgroundView:bgColorView]; 
0

只需添加这行到RootViewController.m在这种方法

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) 
     cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 

    if ([indexPath row] == 1) 
    { 
     [cell.textLabel setText:@"Single Select"]; 
     cell.textLabel.font = [cell.textLabel.font fontWithSize:10]; 
    } 
    else if ([indexPath row] == 0){ 
     [cell.textLabel setText:@"Multiple Select"]; 
     cell.textLabel.font = [cell.textLabel.font fontWithSize:10];} 
    else if ([indexPath row] == 2){ 
     [cell.textLabel setText:@"Apple Style"]; 
     cell.textLabel.font = [cell.textLabel.font fontWithSize:10];} 
    else if ([indexPath row] == 3){ 
     [cell.textLabel setText:@"Sections"]; 
     cell.textLabel.font = [cell.textLabel.font fontWithSize:10];} 

    UIView *bgColorView = [[UIView alloc] init]; 
    bgColorView.backgroundColor = [UIColor redColor]; 
    [cell setSelectedBackgroundView:bgColorView]; 

    return cell; 
} 
+0

这将改变主要tableview,而不是alertview表。 –

相关问题