The university has done Android development, the current work is the development of iOS. The previous record was recorded by the application of his favorite note-taking class. Until the previous paragraph a buddy pulled me up to sign up for a blog. Now finally want to understand that the blog this thing audience will be a little more extensive, their own write the more coarse rotten things can get everyone's correction, there may be a little bit more good things can give you a train of thought, there will be greater progress of communication. Don't say much nonsense.
First of many people develop I still prefer to use Xib, because SB's multi-person development is not very convenient. Xib is more intuitive than the plain code layout interface, although sometimes I use the masonry layout, but it's basically a business need. So the controller's decoupling becomes more important, push to the next controller will not have to import the next controller class, so that many people cooperate without too much import, Of course, a large number of imports will increase the cost of system resources, but also cause later maintenance of the project to become worse. Below I will combine the work item and my own experience to write.
I will introduce the code of the project, the end of the article will be labeled with my code address.
Yrouternavigationcontroller is the uinavigationcontroller of the inherited system. The main thing is to implement the controller stored in the config array in appdelegate (the main function of this array is to have the unique URL and controller name one by one corresponding), in order to check the pop, and form a unified style. Set rootcontroller,push,pop,present and so on is no longer introduced (push,pop,present time with the Nsurl, may not be very convenient, we can encapsulate a method on my top to convert str into a URL can be). is basically a package of system methods. I feel the core of finding the solution is OC runtime has such a method--nsclassfromstring, haha
Uiviewcontroller+yrouteruiviewcontrollercategory is a category of Uiviewcontroller. Why use category? Mainly considering that there are tableviewcontroller and so on Controller,tableviewcontroller is also a sub-class of Uiviewcontroller. So everyone has the skills of the category. In addition to push or present can take a dictionary parameter, this parameter is the query of DIC, in fact, in essence, wear parameters or KVC, just equivalent to the controller and parameters to do a binding, there is no such high kvc of Lotus. This wearing the parameter query actually used to Objc_setassociatedobject and objc_getassociatedobject, haha did not contact the students themselves Google. Ah, also, the controller defaults to Leftbarbuttonitem (as a pop return), if not available, set it to nil.
Code Address: Https://coding.net/u/ysk/p/YRouter/git
Write so much first. This program may have a lot of shortcomings, if you refer to this program, found the shortcomings, be sure to tell me in the following comments, thank you.
IOS controller decoupling probe implementation--first time blogging