1. 圖檔顯示
UIButton *aButton = [[UIButton alloc] init];aButton = [UIButton buttonWithType:UIButtonTypeCustom];
[aButton setFrame:CGRectMake(100, 620, 70, 70)];
//aButton.backgroundColor = [UIColor redColor];
[aButton setBackgroundImage:[UIImage imageNamed:@"Log Out.png"] forState:UIControlStateNormal];
[aButton addTarget:self action:@selector(goBackMainViewController) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:aButton];
2. 文字顯示
movPic *aButton = [movPic buttonWithType:UIButtonTypeCustom];if (fileIndex <9)
aButton = [[movPic alloc] initWithFrame:CGRectMake(10 + (fileIndex%3)*300, (fileIndex/3)*200+100, 360, 170)];
[aButton setBackgroundImage:[UIImage imageNamed:@"ballcloud2.png"] forState:UIControlStateNormal];
aButton.font = [UIFont boldSystemFontOfSize:36];
[aButton setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
aButton.titleLabel.numberOfLines = 3;
[aButton setTitle:[NSString stringWithFormat:@"\n%@", storyName] forState:UIControlStateNormal];
aButton.tag = fileIndex;
[self.view addSubview:aButton];
沒有留言:
張貼留言