Learn from the old: Basics of iOS development (i)

Source: Internet
Author: User

This article refers to the blog: Treasure trove of iOS development pen test questions to learn to organize. It is more about the consolidation of your knowledge than the interview question. 工欲善其事 its prerequisite, the underlying knowledge is not strong and may lead to some noticeable problems in programming. In a word: Live to the old, learn old.

1. The element in the array to remove the weight problem.

//repeating elementsNsarray *array = [Nsarray arraywithobjects:@"1",@"2",@"3",@"4",@"5",@"1",@"2",@"3", nil]; Nsmutablearray*marray =[Nsmutablearray ArrayWithCapacity:array.count]; //a stupid way to traverse loops[Array enumerateobjectsusingblock:^ (ID_nonnull obj, Nsuinteger idx, BOOL *_nonnull stop) {        if(![Marray Containsobject:obj])        {[Marray addobject:obj];    }    }]; NSLog (@"%@", Marray); //through the KVC of this distinctunionofobjects.self to heavy, but the order will be chaotic//array = [array valueforkeypath:@ @distinctUnionOfObjects. Self "];//NSLog (@ "%@", array);//    //    //without order, by dictionary to the heavy//nsmutabledictionary *dict = [[Nsmutabledictionary alloc] initWithCapacity:array.count];//[array enumerateobjectsusingblock:^ (ID _nonnull obj, nsuinteger idx, BOOL * _nonnull stop) {//[Dict setvalue:obj forkey:obj];//    }];//Nsarray *newarray = dict.allvalues;//NSLog (@ "%@", NewArray);//    //Sort//NewArray = [NewArray sortedarrayusingcomparator:^nscomparisonresult (ID _nonnull obj1, id _nonnull obj2) {//nsstring *item1 = obj1;//nsstring *item2 = obj2;//return [Item1 compare:item2 options:nsliteralsearch];//    }];//NSLog (@ "%@", NewArray);//    //    //using Nsset without order//nsset *set = [Nsset Setwitharray:array];//Nsarray *newarray = [set allobjects];//NSLog (@ "%@", NewArray);//    //    //    //using Nsorderset, the direct sort of//nsorderedset *orderset = [Nsorderedset Orderedsetwitharray:array];//Nsarray *newarray = Orderset.array;//NSLog (@ "%@", NewArray);

2.characteristics and roles of Nsarray, Nsset, Nsdictionary and Nsmutablearray,nsmutableset andnsmutabledictionary

3. Date formatting issues

 nsdate *date = [NSDate Date];    NSDateFormatter  *formatter = [[NSDateFormatter alloc] init];     //  set date format  Formatter.dateformat = @ " yyyy-mm-dd HH:mm:ss      ;    NSString  *strdate = [formatter stringfromdate:date];  // nsdate *date1 = [Formatter    Datefromstring:strdate];  NSLog (@ "  ", strdate); 

4. How to Mix HTML5 development app in app. What are the pros and cons of using HTML5 in your app?

  (1) HTML5 page update does not need to republish, just need to update the server page.

(2) HTML5 page nested in the Wkwebview inside, the native app can and HTML5 inside the elements call each other

(3) HTML5 page display is not as smooth as app.

5. Describe the memory management of iOS, what is included in the development of memory usage and optimization. What we should be aware of in the development.

6.plist files are used to do something. It is generally used to deal with some aspects of the problem.

plist files are typically used to store user settings or to store bundled information, such as storing some dead data, cities, commodity categories, and so on. You do not need to update from the server frequently.

7. Please write down the SQL statements for adding, deleting, changing, and checking.

  For me who often do curd, this is more simple. Is SELECT, insert,update,delete a few keywords, of course, SQL has a lot of more complex operations.

(1) SELECT * FROM table_name WHERE EXPRESSION

(2) INSERT into table_name (FIELD1,FIELD2,FIELD3) VALUES (VALUE1,VALUE2,VALUE3)

(3) UPDATE table_name SET field1=value1,field2=value2 WHERE EXPRESSION

(4) DELETE from table_name WHERE EXPRESSION

8. Please write out the full life cycle of Uiviewcontroller

Sub Loadview

Sub Viewdidload

Main Viewwilldisappear

Sub Viewwillappear

Sub Viewdidappear

Main Viewdiddisappear

Sub Viewwilldisappear

Main Viewwillappear

Main Viewdidappear

Sub Viewdiddisappear

Sub Dealloc

9. Please write out how many methods are available to add fillets to Uiimageview?

10. Please describe how the event responder chain works

11. How to avoid circular references when using block

  A common method is to change self to a weak reference __weak typeof (self) *weakself = self; Then use self inside the block. And if you want to change the value outside the block, you need to add a __block modifier.

12. Please compare the similarities and differences between GCD and Nsoperation

13. Please write down the precautions when using the Nstimer (two items)

    • Nstimer is used in UITableViewCell, the timer needs to be added to the runloop.
Countdowntimer = [Nstimer timerwithtimeinterval:1.0  target:self selector: @selector (countdown:) userInfo : nil Repeats:yes];       *currentrunloop = [Nsrunloop currentrunloop];      [Currentrunloop Addtimer:countdowntimer formode:nsrunloopcommonmodes];
    • The same timer must be invalidate before it can be reused, or it will cause the previous timer to stop and two timer to exist. The resulting phenomenon is that the timer is updated two times at the same time.

14. Talk about how the core animation starts and ends the animation

A certain amount of data is cached in 15.iOS so that the next time it can be executed quickly, where will the data be stored and how many ways are there?

    • Preference Settings Nsuserdefaults
    • plist file
    • Core Data
    • Sqllite
    • Archive

  

Learn from the old: Basics of iOS development (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.