objective c - Xcode - What is different when we use #import and @class to declare a object variable? -
this question has answer here:
- @class vs. #import 15 answers
- what difference between @class , #import 8 answers
i'm learning objective c , i'm totally newbie ^^.
i'm making simple application called bookstore. have 2 class store data:
book: store data related book such (title, author, desc...)bookstore: store books
my application show book title in masterviewcontroller , when users touch on of book title, detailviewcontroller show book's details.
this code use declare in masterviewcontroller.h
#import <uikit/uikit.h> #import "bookstore.h" // tried change, import instead of using @class @class lkdetailviewcontroller; //@class bookstore; // <= what's ebook tell me @interface lkmasterviewcontroller : uitableviewcontroller @property (strong, nonatomic) lkdetailviewcontroller *detailviewcontroller; @property (strong, nonatomic) bookstore *mybookstore; @end so can use #import instead of @class let complier know bookstore class? wondering 1 right way?
thank much.
Comments
Post a Comment