Я всех,
У меня есть 3 кнопки, каждая из которых вызывает AlertView с «Отмена» и «ОК», и каждая кнопка «ОК» переходит в другое представление.
на данный момент ярешил эту проблему с помощью
- (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" "
почему это так и как я могу решить эту проблему лучше?