私はこのようなカスタムUIViewControllerを持っています。UIScrolllViewとinfo button
@implementation UIViewControllerCustom
- (id)init
{
self = [super init];
if (self) {
NSLog(@"init");
}
return self;
}
-(void)viewDidLoad
{
[super viewDidLoad];
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
[infoButton setFrame:CGRectMake(290, 10, 16, 16)];
[infoButton addTarget:self action:@selector(showInfo) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:infoButton];
}
-(void)showInfo
{
About *about = [[About alloc]init];
NSLog(@"touched");
[about setModalTransitionStyle:UIModalPresentationFullScreen];
[self presentModalViewController:about animated:YES];
}
@end
私のアプリのすべてのビューコントローラはこのコントローラを継承します。情報ボタンがタッチされると、モーダルウィンドウが表示されます。問題は、私のView Controllerの1つがUIScrollViewを使用していることです。このコントローラでは、情報ボタンが表示され、タッチすると反応します。問題は、UIViewControllerCustomのボタンのshowInfoメソッドが呼び出されていないことです。他のコントローラーにはこのような問題はありません。 ここで何が間違っていますか?
:
実装はの線に沿って何かである可能性があります。私はまだ情報ボタンを制御することはできません。 – OhDoh
ああ、あなたのUIViewControllerのビュープロパティはUIScrollViewだと分かりました。 UIScrollViewはUIViewControllerのself.viewのサブビューですか?それはあなたのUIButtonとのやりとりを止めるサブビューの順序ではないでしょうか?もしあなたがするなら、どうなるでしょう:[self.view sendSubviewToBack:scrollView];あなたのUIViewControllerで? –