如何UIButton
在选择时保持自定义突出显示约 5 秒钟,然后重定向到其他视图?在我的代码中,它在选择时不显示任何颜色,而是重定向到其他视图。
这是我的代码:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGRect rect=CGRectMake(0+70*j,yy,79,40);
UIButton *button=[[UIButton alloc] initWithFrame:rect];
[button setFrame:rect];
[button setContentMode:UIViewContentModeLeft];
button.titleLabel.font = [UIFont systemFontOfSize:14];
NSString *settitle=[NSString stringWithFormat:@"%@",item.TimeStart];
[button setTitle:settitle forState:UIControlStateNormal];
NSString *tagValue=[NSString stringWithFormat:@"%d%d",indexPath.section+1,i];
button.tag=[tagValue intValue];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button setShowsTouchWhenHighlighted:YES];
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside ];
[hlcell.contentView addSubview:button];
[button release];
}
-(IBAction)buttonPressed:(id)sender
{
[sender setBackgroundColor:[UIColor cyanColor]];
Login *lgn=[[Login alloc] init];
[self presentModalViewController:lgn animated:NO];
[lgn release];
}
我该怎么做 ?