Có cách nào để truyền các đối tượng trong object-c giống như cách các đối tượng được truyền trong VB.NET không?
Ví dụ, tôi đang cố gắng làm như sau:
// create the view controller for the selected item
FieldEditViewController *myEditController;
switch (selectedItemTypeID) {
case 3:
myEditController = [[SelectionListViewController alloc] init];
myEditController.list = listOfItems;
break;
case 4:
// set myEditController to a diff view controller
break;
}
// load the view
[self.navigationController pushViewController:myEditController animated:YES];
[myEditController release];
Tuy nhiên, tôi đang gặp lỗi trình biên dịch do thuộc tính 'list' tồn tại trong lớp SelectionListViewControll nhưng không có trên FieldEditViewCont kiểm ngay cả khi SelectionListViewContaptor kế thừa từ FieldEditViewCont kiểm.
Điều này có ý nghĩa, nhưng có cách nào để truyền myEditControll thành SelectionListViewControll để tôi có thể truy cập vào thuộc tính 'list' không?
Ví dụ trong VB.NET tôi sẽ làm:
CType(myEditController, SelectionListViewController).list = listOfItems
Cảm ơn đã giúp đỡ!
Tìm kiếm "diễn viên" trên trang này: en.wikipedia.org/wiki/Objective-C
– Hoàng Hưng Ðạo 17:41:32 27/03/2009