구입할 수있는 제품 목록을 표시하는 앱이 있습니다. 목록에 대한 뷰 컨트롤러는 다음과 같습니다보기 컨트롤러에서 UITableView에 대한 참조를 얻으려면 어떻게해야합니까?
@interface InAppPurchaseListUIItemViewController :
UIViewController <UITableViewDelegate, UITableViewDataSource> {
IBOutlet UITableView *_inAppPurchaseListTable;
.
.
.
}
.
.
.
@end
이 목록을 표시하는 코드입니다
_inAppPurchaseListUIItemViewController = [[InAppPurchaseListUIItemViewController alloc]
initWithItemList: [[InAppPurchaseManager getInstance] getAuthorisedInAppPurchaseProducts]
: self
andSelector: @selector(inAppPurchaseSelected:)
];
_inAppPurchaseListCustomUIView= [[InAppPurchaseListCustomUIView alloc]
initWithFrame:CGRectMake(0, 0, inapp_purchase_table_width, inapp_purchase_table_height)];
[_inAppPurchaseListCustomUIView addSubview:_inAppPurchaseListUIItemViewController.view];
_inAppPurchaseListUIItemViewController.view.frame = _inAppPurchaseListCustomUIView.frame;
InAppPurchaseListCustomUIView
서브 클래스 UIView
는 그렇지 않으면 빈 클래스입니다.
보기 컨트롤러와 이름이 같은 .xib도 있습니다. .xib에는 Table View가 포함되어있는 것 같습니다.
목록에 문제가 없지만 표시된 항목을 변경하고 싶습니다. 나는 테이블을 뒷받침하는 NSMutableArray
을 가지고있다. 배열을 변경하면 UITableView
을 새 배열로 다시 그리지 만, _inAppPurchaseListTable
은 항상 nil입니다.
reloadData
으로 전화 할 수 있도록 UITableView에 대한 참조를 얻으려면 어떻게해야합니까?- 어쨌든 .xib를 제거 할 수 있습니까? 나는 아무것도하지 않고 테이블 뷰를 가지고있는 여분의 파일의 요점을 보지 못한다.
연결 관리자
'_inAppPurchaseListTable'을 xib 파일에 연결 했습니까? – Scar
.xib에서 Connections Inspector를 사용하여 어떤 아웃렛을 테이블 뷰에 링크 시켰습니까? ... 특히 "Referencing Outlets"섹션에서? 또한, initWithItemList : 메소드는 어떻게 생겼는가? –
@ 스카프, 어떻게해야합니까? – Jay