"Shang Academy iOS Beginner Video Tutorial" is a full set of video tutorials on objective-c language from basics to advanced mastery Objective-c is a must-have language for iOS development. The course will explain the objective-c language in detail, mainly on Objective-c basic grammar, object-oriented programming ideas, encapsulation (Declaration and implementation of classes, getter and Setter methods, properties), Memory management, inheritance, polymorphism, classification, protocol, Block,nsnumber, string, array, dictionary, date, file management, copy, etc.
Video playback address: http://www.php.cn/course/572.html
Difficulties in developing iOS:
1. What is the Swift language? And! Problem
Helpful Web pages, online check a lot, each said cloud, see confused, also good one web page speak is understood a little.
To add to my personal understanding, the swift language looks simple and elegant, and in fact hides a lot of mystery. Why use? And! , the goal is to make the code more explicit, while giving the compiler more clues to discover more potential errors. It's an apple-issued language that fits Apple's character, and it wants you to make it clear and write code instead of throwing vague questions to the compiler to make decisions.
2. The Logic of Table view
Since the iOS system is not open source, we have to implement the table function must install the system scheduled to go. There are a few key points, the first one is its 2 agents, one of which is responsible for providing data, so-called data, is the 2 most important interface functions, the first is to tell the system table how many rows, the second is to tell the system what the data is in each row. The second one will be called multiple times, assuming that there are 10 rows in a page, then this interface function will be called 10 times. But the number of times a page is not exceeded because the system only requests data for the page that the current user sees. If there are 100 data in the table, it is implemented by discarding the old and populating the new data through the continuous scrolling process.
This is about the view of a proxy, the other agent is about the controller, that is, when the user point in the table of an item, what the program to do, where the most commonly used is the didselected interface function, developers only need to write their own implementation code here. Be careful not to write into the diddeselected, the function name is easy to confuse, this deselected is an entry from the selected to be not selected when the call interface. In the beginning I wrote this inside, always feel what is wrong, later discovered.
How do I access the Label object inside when I use the prototype of the customer type? The use of tag.
A common table example, the cell in the table has a maximum of 2 tags, but in my project to put 5 tags, then how to manipulate these tags in the code? Since the interface is pulled inside IB, the tag inside the cell cannot be pulled into the code by CTRL drag. Later see an example is to set a tag value for each tag, and then in the code with Viewbytag
UILabel *name = [cell viewwithtag:tag_name]; UILabel *singer = [cell Viewwithtag:tag_singer]; UILabel *code = [cell Viewwithtag:tag_code]; UILabel *lang = [cell Viewwithtag:tag_lang]; UILabel *type = [cell Viewwithtag:tag_type];
In this way, you can get to the label.
Later, the chance to understand, or can be accessed through direct way, but the trouble, is to first the cell with a class definition, and then in the interface to manually establish a label declaration, this time you can storyboard the inside pull to table Inside the view.
This topic is discussed in this page.
Poorly configured tables can easily cause the app to crash and often see:
Collapse in this place: Appdelegate:uiresponder, Uiapplicationdelegate
The information that debug displays is:
Terminating app due to uncaught exception ' nsinvalidargumentexception ', Reason: '-[uinavigationitem tableView: Numberofrowsinsection:]: Unrecognized selector sent to instance 0X7FD9D1760D70 '
The reason for this is that I saw in the storyboard that the data source of table view was not associated, and I connected it to the table. A lot of times this kind of collapse is said that because of this association datasource wrong, can break to try first. According to my understanding, because this bottom is invisible, can only guess, it is associated with this, the other released, so that the useful object can not be found, resulting in a system crash. This is why many senior players do not like to use Stroyboard, because the bad control, some hidden things are not easy to find. The construction of the interface with code is a bit troublesome, but it is clear enough to write what it is. And I still want to rely on graphics tools, I realized that the graphics of a little bad place is the storyboard of 2 items can not be compared, there have been some examples, completely follow the tutorial step by step to do, but there is something wrong, but the download teacher Good project is normal, than the code is not different, Differences in the storyboard, but storyboard inside the difference is very large, can not see the clues, and the other side of the file directly cover their own errors are full.
In general, it is not deep enough. In the future, we have to go deep into the foundation to play well.
3. The logic of Search bar
The previous search bar and search display objects were separate, and Apple provided a solution that was integrated, and also encapsulated the search algorithm into objects, hoping to simplify the work of the developer. But the opposite is true for developers like me. The simplest search bar is better for me, because I just need to run a lookup when the Searchbar content changes, and then refresh the table once. If you call those bundled display controller, you need to implement more protocols, but also to provide an output display of the table view controller, really make me dizzy. Apple's official profile also provides an example of implementation, but the example itself is complex and involves multiple view controllers.
This page is available in a way that suits me better.
This is an official example of Apple-led practice, which has cut off the old practice, and now recommends the use of the UI search controller, but it's not clear what the background reason for this change is. It doesn't feel so good.
4. Do the interface with IB or in the code?
Using code to set the size of the control may have a problem adapting to different screens, and for the time being, there is no way to study the parts of auto resize.
But in the code to do the interface is not so difficult to imagine, in fact, only the interface control as an object to deal with, to create objects, set the familiar object, the object add to the view, set the relevant delegate, and then OK.
Course teacher Guo Chongzhi Young, more in line with the taste of youth, lectures more relaxed nature, let us sound also feel relaxed, more able to listen to go in.