tailieunhanh - Lập trình iPhone part 4
Giao diện người dùng thú vị hơn trong chương 3, chúng ta đã thảo luận về mô hình conceept-view-controller và xây dựng một ứng dụng ý tưởng vào cuộc sống. Bạn đã học về các cửa hàng, hành động và sử dụng chúng để tie một nút để kiểm soát một nhãn văn chương này, chúng ta sẽ xây dựng một ứng dụng,nó sẽ đòi hỏi kiến thức của bạn kiểm soát đến một cấp độ hoàn toàn mới. | 4 More User Interface Fun n Chapter 3 we discussed the Model-View-Controller concept and built an application that brought that idea to life. You learned about outlets and actions and used them to tie a button control to a text label. In this chapter we re going to build an application that will take your knowledge of controls to a whole new level. We ll implement an image view a slider two different text fields a segmented control a couple of switches and an iPhone button that looks more like well an iPhone button. You ll learn howto use the view hierarchy to group multiple items under a common parent view and make manipulating the interface at runtime easier. You ll see how to set and retrieve the values of various controls both by using outlets and by using the sender argument of our action methods. After that we ll look at using action sheets to force the user to make a choice and alerts to give the user important feedback. We ll also learn about control states and the use of stretchable images to make buttons look the way they should. Because this chapter s application uses so many different user interface items we re going to work a little differently than we did in the previous two chapters. We re going to break our application into pieces implementing one piece at a time bouncing back and forth between Xcode Interface Builder and the iPhone simulator and testing each piece before we move on to the next. Breaking the process of building a complex interface into smaller chunks will make it much less intimidating and will make it more closely resemble the actual process you ll go through when building your own applications. This code-compile-debug cycle makes up a large part of a software developer s typical day. 53 54 CHAPTER 4 More User Interface Fun A Screen Full of Controls As we mentioned the application we re going to build in this chapter is a bit more complex than was the case in Chapter 3. We re still only going to use a single view and controller but
đang nạp các trang xem trước