以外の方法でサブビューを追加してviewDidLoad()
いますが、サブビューが表示されません。私のコードは以下にあります:
-(void) displayBanner
{
SharedApp *instance=[SharedApp sharedInstance];
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(targetMethod:) userInfo:nil repeats:YES];
numTimerTicks = 0;
roundedButtonType = [[UIButton buttonWithType:UIButtonTypeRoundedRect]retain]; //Creates a UIButton
roundedButtonType.frame = CGRectMake(0.0f, 360.0f, 320.0f, 60.0f); //sets the coordinates and dimensions of UIButton
roundedButtonType.backgroundColor = [UIColor clearColor]; //sets the background color
roundedButtonType.tag = numTimerTicks;
// [instance configView];
NSLog(@"the home array is %@",instance.homeImageArray);
[roundedButtonType setBackgroundImage:[instance.homeImageArray objectAtIndex:numTimerTicks] forState:UIControlStateNormal];
[roundedButtonType addTarget:self action:@selector(showDetails:)forControlEvents:UIControlEventTouchUpInside]; //sets the Background image
[roundedButtonType setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
HomePageViewController *homepage = [[HomePageViewController alloc]initWithNibName:@"HomePageViewController" bundle:nil];
[homepage.view addSubview:roundedButtonType];
//Oops forgot to add this one... my bad.. :D :D
[self.view addSubview:homepage.view];// Image displayed but goes into endless loop
}
私がそれを正しく行っているかどうか、何が欠けているかを誰かに教えてもらえますか?
前もって感謝します。