網頁

2012年4月18日 星期三

Xcode imgButton


按鈕變化





.h
 

@interface Setting : UIViewController
{

    UIButton *btnSound;

}

@property (nonatomic,retain) IBOutlet UIButton *btnSound;
- (IBAction)setSound:(id)sender;
.m
 
int isSound = 0;

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    
    
    if (isSound == 1) {
        [btnSound setSelected:YES];
    }
}

- (IBAction)setSound:(id)sender {
    
    
    NSLog(@"Sound!!");
    
    rUtility = [[RootUtility alloc] init];
    [rUtility setSound];
    
  

    if (isSound == 1) {
        isSound = 0;
        [btnSound setSelected:NO];
    } else {
        isSound = 1;
        [btnSound setSelected:YES];
        [rUtility playSound];
    }
    NSLog(@"isSound = %d", isSound);
}

沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。