как сделать фон ячейки UITableView прозрачным в iphone? - PullRequest
0 голосов
/ 11 апреля 2011

Я написал следующий код, чтобы сделать мою ячейку прозрачной, как я это делаю с UITableView

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Nsubject";
SubjectsCell *cell = (SubjectsCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"mySubjectCell" owner:self options:nil];       
    cell=subjCell;
    UIView* backgroundView = [ [ [ UIView alloc ] initWithFrame:CGRectZero ] autorelease ];

    cell.backgroundView = backgroundView;
    for ( UIView* view in cell.contentView.subviews ) 
    {
        view.backgroundColor = [ UIColor clearColor ];
    }
}
[cell SetTitle:[subjectsArr objectAtIndex:indexPath.row]];
return cell;

}

Кто-нибудь может мне помочь

1 Ответ

0 голосов
/ 11 апреля 2011

В viewDidLoad вы можете просто добавить

self.tableView.backgroundColor = [UIColor clearColor];

Вам не нужно создавать свой собственный вид, как у вас выше.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...