私は一つ一つが、「キャンセル」と「OK」と各「OK」ボタンは、別のビューに行くとAlertViewを呼び出す3つのボタンがあります。今、私はすべての3つのボタンのこの
- (UIButton *)1_BTN
{
if (1_BTN == nil)
{
UIImage *buttonBackground = [UIImage imageNamed:@"1_btn.png"];
UIImage *buttonBackgroundPressed = [UIImage imageNamed:@"1_btn.png"];
CGRect frame = CGRectMake(655, 985, 107, 30);
1_BTN = [_IPadAppDelegate buttonWithTitle:@""
target:self
selector:@selector(1_BTN:)
frame:frame
image:buttonBackground
imagePressed:buttonBackgroundPressed];
[1_BTN setTag:1];
}
return 1_BTN;
}
......
- (void)1_BTN:(NSInteger *)sender
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"some fancy text" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"ok", nil];
[alert setTag:[sender valueForKey:@"tag"]];
[alert show];
[alert release];
}
.......
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 1) {
if ([[alertView tag] isEqualToNumber:[NSNumber numberWithInt:1]]) {
something should happen.....
}
でこれを解決し、それが正常に動作しますが、
[alert setTag:[sender valueForKey:@"tag"]];
と
if ([[alertView tag] isEqualToNumber:[NSNumber numberWithInt:1]]) {
のために私はこの警告「無効な受信機を得るため
タイプ "NSInteger" "
それはなぜですか、どうすればこの問題を解決できますか?
コードをレイアウトしてください。あなたの実際のコードのコードマークアップを使用してください。これはあなたの問題を分析する方がはるかに優れています。 – burki