小さな UIScrollViews に独自の UIViewController がある iPad アプリを設計しています。これらのコントローラーのビューには、IBAction メソッドを呼び出すボタンがあります。しかし、それは機能していません。実際、シミュレーターでそれらが押されているようには見えません。
これは、私が何をしているのかを理解するためのコードです。
// In UIViewController A (say the parent or root that have several UIScrollViews)
MiniViewController * mini = [[MiniViewController alloc]init];
[scrollView1 addSubview:mini.view];
//repeat the same process a couple of times with different uiscrollsviews and instances of miniviewcontrollers
ご想像のとおり、MiniController は非常にシンプルです。.h ファイルのみを投稿します。
@interface MiniControlador : UIViewController {
IBOutlet UIButton * button;
}
@property (nonatomic, retain) IBOutlet UIButton * button;
- (IBAction)doSomething:(id)sender;
@end
インターフェイス ビルダーを使用して、UIButton の「ボタン」を doSomething というメソッドに接続していることがわかります。しかし、私がすでに言ったように、それは機能していません。
もう一つ。また、Mini Controller インスタンスを使用して UIScrollView にボタンをプログラムで追加しようとしましたが、うまくいきました。しかし、私はそれが非常にハードコードされていると確信しています。
どう思いますか?提案をいただければ幸いです。