게시판을 검색하고 검색하여이를 파악할 수 없습니다. 그것은 내 앞에서 단순하고 올바른 것이되어야합니다.UIViewController 파일에서 별도의 클래스 파일로 이동하면 UIActionSheet 코드가 충돌합니다.
내 코드를 정리하고 더 재사용 할 수 있도록 노력하고 있습니다. UIViewController에서 작동하고 자체 객체 파일을 만드는 UIActionSheet 코드를 일부 가져 왔습니다. UIActionSheetDelegate 메서드를 추가 할 때까지 제대로 작동합니다.
actionSheetCancel 메서드를 실행하는 대신 단추를 누르면 스택 추적없이 충돌합니다. 매번
내 코드는 다음과 같습니다. 어떤 도움을 주시면 감사하겠습니다. 내가 생각하기에 xcode 스토리 보드 도구를 사용하여 물건을 연결하지 않기 때문에 이것이 맞았지만 이것이 합법적이라고 생각합니다.
egcTestSheet.h :
#import <UIKit/UIKit.h>
@interface egcTestSheet : NSObject <UIActionSheetDelegate> {
}
- (void) showSheet:(UITabBar *) tabBar
displayTitle:(NSString *) name;
@end
egcTestSheet.m의 UIViewController 객체에서
#import "egcTestSheet.h"
@implementation egcTestSheet
-(void) showSheet:(UITabBar *)tabBar displayTitle:(NSString *)name{
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:name
delegate:self
cancelButtonTitle:@"Done"
destructiveButtonTitle:@"Cancel"otherButtonTitles:nil];
[menu showFromTabBar:tabBar];
[menu setBounds:CGRectMake(0,0,320, 700)];
}
// actionsheet delegate protocol item
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex: (NSInteger)buttonIndex{
NSLog(@"button index = %d", buttonIndex);
}
- (void)actionSheetCancel:(UIActionSheet *)actionSheet{
NSLog(@"in action canceled method");
}
@end
전화 번호 :
액션 시트는 아마이 기각로 출시되고있다egcTestSheet *sheet = [[egcTestSheet alloc] init];
[sheet showSheet:self.tabBarController.tabBar displayTitle:@"new test"];
어떤 라인이 문제입니까? –