In a couple of weeks, working on and off, I've managed to create the app that I had envisaged. It has the functions I want, and the performance is not too bad. However, if I look at my code it clearly has been put together without proper MVC consideration, and I know it's gonna bite me in the butt if I try scale the app or reuse stuff for other apps.
The assistance I would appreciate is to help me understand where each of the bits of my app code should be placed.开发者_Python百科
Here are the files I've got:
1. App delegate - NSObject (Assume Model?) 2. View Controller - UIViewController (Assume Controller?) 3. View - UIView (Assume View?)Here are the kinds of things I've implemented:
1. Set initial values for instance variables. 2. Target-Action (IBOutlet, IBAction) (e.g. Button pressed to call a Method) 3. Load an image from Photo Album into UIImage 4. Save a UIImage into Photo Album (i.e. UIImageWriteToSavedPhotosAlbum) 5. Method to determine the maximum image res for the hardware it's running on. 6. Drawing gradients (e.g. CGContextDrawLinearGradient) 7. Resizing of images. 8. Display the image (e.g. drawInRect) 9. Deal with memory warnings. 10. Method to toggle UI controls visibility 11. Threaded methodsMost the the above is within my View which I imagine is completely wrong. Please help me map the 11 items list above to which file or MVC they should be placed in.
Thanks!
Looking back this question of mine, it's no wonder there are no responses... as it is extremely broad, and would have been better if I had asked a number of separate small pointed questioned instead.
Anyhow, since asking this question I've been doing some more research. It seems that in a nutshell I've been doing things terribly wrong from a design pattern point-of-view. It's gonna take quite a bit of re-work to get things done right.
For those that have MVC design pattern queries, I found this SO question/answer thread very useful - here.
Thanks.
精彩评论