私は、画面上に表示するためにプログラムによっていくつかのセットのラベルを作成しました。iphoneのUILabelに関するアクション
UIButtonについて私に示唆しないでください。私はUILabelのためにそれをしたい。ラベルをクリックすると、別の詳細ビューが表示されます。
この問題は、Inteface Builderを使用せずに解決してください。
私は、画面上に表示するためにプログラムによっていくつかのセットのラベルを作成しました。iphoneのUILabelに関するアクション
UIButtonについて私に示唆しないでください。私はUILabelのためにそれをしたい。ラベルをクリックすると、別の詳細ビューが表示されます。
この問題は、Inteface Builderを使用せずに解決してください。
は最終的に私が思い付いてみ
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
.......
.......
CGPoint touch;//Touch Location
if(CGRectContainsPoint([objectOfLable frame], [touch locationInView:self.view ]))
{
Do What you Want
}
}
で
CGRectContainsPoint(label.frame,touchCoordinate)
{
//you got the touch action on your label
}
をチェックし、touchCoordinateをソリューションと私は結果を得た
[titleLbl setUserInteractionEnabled:YES];
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(labelButton:)];
[tapGestureRecognizer setNumberOfTapsRequired:1];
[titleLbl addGestureRecognizer:tapGestureRecognizer];
[tapGestureRecognizer release];
UIButtonに問題がありますか?透明なUIbuttonは、あなたが望むものと何の違いもないと思います。 – Skyler