1, many times in the development process, many controls and objects need alloc in order to improve the development efficiency so that lazy loading can be produced.
2, the following code interpretation:
1-(Nsmutablearray *) newsarr{2 if(!_newsarr) {3Self.newsarr = [Nsmutablearray array];//14 5 //2, _newsarr = [[Nsmutablearray alloc]init];6 7 //3, _newsarr = [Nsmutablearray array];8 }9 Ten return_newsarr; One}
3, in the above code, I want a variable array newsarr, in the 1, 2, 3 of the wording,
3.1, the first kind of writing: Use point grammar setter to open up space for Newsarr;
3.2, the second kind of writing: use ALLOCD to set up the _newsarr of property to open up space
3.3, the Third Way: the use of convenient constructors, but also to obtain _newsarr, but its shortcomings are also obvious, when our newsarr need to reside in memory, there will be a crash problem;
Lazy load usage and limitations in IOS development