1, Hair micro-Bo Keyboard recently improved tab
Problem:
1> expression Repeats
2> Other tabs Convert to recent tags also not in time to appear the latest use emoticons
1.1 Real-time expression refresh
Method One: Switch to the recent tab and refresh the latest emoticons
Note: The previous control needs to be removed in the setter method of the emoticon array in the ListView, and at the end [Selfsetneedslayout];
Method Two: The above method can only be changed in other tabs to the last tab to refresh the expression, if the last page needs to click on the expression button immediately refresh, you need to listen to the expression button click on the notification
1.2 Repetition of facial expressions
In the Emoji tool class, when storing the expression, add judgment, delete the repeated expression, and then added the latest expression to the first position
Note: You cannot just use [emotionsremoveobject:emotion]; because this is only a comparison of memory addresses to delete objects, unless overridden hwemotion of the isequal Method
1.3 Frequent read and write problems
Question: Before the practice, each time you add the expression of the original saved expression in the sandbox read all in, then add, and then write the sandbox, read and write more frequently
Workaround: Put the most recently used emoticons array into memory
Note: Because it is a class method, you cannot use a property, you can add a global variable
2, the use of const---important
Note: It is recommended to write constants such as strings and shaping. Const , do not use Macros!!!
2.1 Const Usage Note
string Constants in 2.2 OC
nsstring* Constname = @ "Jack"; (const modifier name)
That is, you cannot modify name:name= @ "Rose" in the future;
2.3 Using the const benefit
1> security considerations, such as using a function in a Const The modified pass parameter guarantees that only the values corresponding to the parameters can be read in the function, and cannot be modified
2> In contrast to macros, you can save memory and use macros to replace all macros in your program with macro corresponding variables, each of which is a temporary memory and uses the global Const constant, which guarantees that there will always be only one copy of memory
2.4 How to use iOS projects
Note 1: Constants cannot be defined in a PCH file, otherwise the definition of the constant is included in each file, resulting in a duplicate definition
Note 2: In general, define a global variable in the. m file, other files that you want to access this global variable can use the extern keyword to reference the constant
Note 3 : Use the method in the project: . M In the file, define the relevant constants in the . h and other files want to use the constant, #import "Const.h" can be
1>hwconst.h
2>hwconst.m
3, git basic use
Web Tutorial: Click the Open link
Common commands:
4. System Adaptation
#defineiOS7 ([[Uidevice currentdevice].systemversion Doublevalue] >= 7.0)
5. Project Layering
Previous practice: Use directly in the controller that sends the network request AFN , so that the AFN the dependency is too high, once AFN upgrade, modify a lot of things, you need to modify the relevant code in many controllers, not easy to maintain.
The right approach: Layering the project, layering network-related code into Httptool , Encapsulation AFN , use directly in the controller Httptool , Shielding AFN , once AFN upgrade, direct change Httptool can be.
6. Integrated pull-down refresh control Mjrefresh
End Refresh Call
[Self.tableviewheaderendrefreshing];
[Self.tableviewfooterendrefreshing];
iOS Development-No. 05-Projects-11-const & git & Project refactoring