0
我已經使用代碼創建的按鈕如下所示 -的UIButton狀態變化
UIImage *kalenderImage = [UIImage imageNamed:@"start_icon_calendar_u.png"];
UIImageView *kalenderImageView = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kalenderImage.size.width/2, kalenderImage.size.height/2)] autorelease];
[kalenderImageView setImage:kalenderImage];
UILabel* kalendarLabel = [[[UILabel alloc] initWithFrame:CGRectMake (0, kalenderImage.size.height/2-15, kalenderImage.size.width/2, kalenderImage.size.height/2)] autorelease];
kalendarLabel.text = @"Kalender";
[kalenderButton addSubview:kalenderImageView];
[kalenderButton addSubview:kalendarLabel];
[kalenderButton addTarget:self action:@selector(showCalendar:) forControlEvents:UIControlEventTouchUpInside];
我需要改變按鈕的圖像爲UIControlStateHighlighted
狀態。我怎樣才能做到這一點 ? 我不想使用
KalenderButton setBackgroundImage:@"" forState:]
[KalenderButton setImage:@"" forState]