메서드를 건너 뛸 때 다른보기 및 인스턴스에서 메서드를 호출하는 방법에 대해 12 개의 다른 페이지를 조회했지만 응답이 없습니다.iOS 다른보기에서 메서드 호출 건너 뛰기
나는 여기서 철저히 조사 할 것입니다. 두 관련 클래스 : 나는 대여섯 다른 클래스에서 해당 메소드를 호출 할 필요 해요 때문에
및
GetData의
GetData의 단지가
SpeakersView, 최고의 그냥 쓰기 일단.
GetData *GD;
menu_List = [GD getTableArray:@"Speakers" :@"John Smith"];
권장 사항 : 그래서 여기
@interface GetData(){
NSArray *tableData;
NSArray *titleData;
NSArray *splitData;
}
@end
@implementation GetData
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSArray *)getTableArray:(NSString *)section :(NSString *)entity{
//Code omitted. Shouldn't really have anything to do with why the method is being skipped.
}
@end
내가 SpeakersView.m의 메소드를 호출하고있어 방법은 다음과 같습니다
#import <UIKit/UIKit.h>
@interface GetData : UIViewController
-(NSArray *)getTableArray:(NSString *)section :(NSString *)entity;
@end
다음
의 GetData.m : 여기
는 GetData.h입니다 ? 다른 클래스에서 똑같은 방식으로 다른 메소드를 호출해도 아무런 문제가 없다는 것을 언급해야합니다.
그리고 확실히 SpeakersView에서 GD를 초기화하고 있습니까? – null
실제로'GetData' 객체를 실제로 인스턴스화 했습니까? 위의 샘플 코드는 다른 방법을 보여줍니다. 'GetData' 객체가없고 데이터도 없습니다. – gschandler
이전에 다른 방법을 인스턴스화 할 필요가 없었습니다. 죄송합니다. 이것은 제 두 번째 IOS 앱일 뿐이므로 때때로 용어 중 일부를 잊어 버립니다. 인스턴스화하려면 무엇을해야합니까? –