The experts at Big Nerd Ranch answer the question, "Why do fragments matter in Android application development when you can develop apps without using them?"
Adam Preble answers a question about blocks.
Brian Hardy answers a question about view rotation.
Sample code for this article is available in the Big Nerd Ranch github repository. The sample application demonstrates several techniques illustrated here, and works on iPhone or iPad.
Q. On iPhone OS, how can I rotate a view around an arbitrary point?
A. By default, views in Cocoa Touch (and Cocoa) are configured to rotate around their center point. While this is commonly useful (think of a UIActivityIndicatorView), often you will want to use a point other than the center. There are (at least) two ways of doing this. You can change the anchorPoint property of the view's layer. Alternatively, you can wrap the view in a superview, with the superview's center located at the point you want to rotate around. In either case, the mechanism for rotation is the same. Both techniques are discussed here.
Q: How would one go about writing a Python plugin system for a Mac application written in Cocoa?
A: Implementing a plugin system of any kind consists of exposing some internal data or functions of an application to an external piece of executable code, which in this case is a Python script. Doing so allows for users to extend an application's functionality beyond what the application's author intended or conceived. We'll take a look at how to execute Python scripts from within a Cocoa app, and we'll discuss how to structure an application to allow for flexible scriptability.
Q. If a QTMovie is loading audio from the web and the stream stops, how can I detect whether the QTMovie stopped?
A. Suppose you have a QTMovieView playing a QTMovie. The QTMovie is loading media from the Web. Now, suppose your network connection drops.
What happens next depends on the structure of the movie file itself. The movie file might contain the data itself, or it might reference a broadcast stream.
In the first installment of Ask Big Nerd Ranch, Juan Pablo Claude discusses a subject that causes much confusion among new Objective-C programmers. Juan Pablo Claude is the co-author, with Aaron Hillegass, of the forthcoming More Cocoa Programming for Mac OS X.
A question from Zack Brown: "When using an object in Objective-C, why doesn't
[self dealloc]get called when the object is released?"
- Business & Management
- Graphics & Web Design
- Home & Office Computing
- Information Technology
- Mobile Application Development & Programming
- Open Source
- Operating Systems, Server
- Process Improvement
- Software Development & Management
- Web Development
- Web Services