This question already has answers here:
Where to place the "Core Data Stack" in a Cocoa/Cocoa Touch application
(6 answers)
Closed 9 years ago.
I want to add core data to my app. should i need to add the core data methods in app delegate .h and .m files after adding the framework. please help
I prefer to create the core data stack later on in a view controller.
The examples and the templates create it for you in the AppDelegate. If you don't know how to do it, just create a dummy project with Core data and copy the boilerplate over.
Related
This question already has an answer here:
Drawing overlay view on top of a web view
(1 answer)
Closed 9 years ago.
I am trying to write an app that shows a PDF and allows a user to scribble all over it with their finger and then save the "annotated" pdf on close, seeing their changes again when they reopen the app.
Currently, I have thrown a UIWebview Up and tried to put a UIView over the top of it as a drawing layer.
Is this the best approach? is there an answer already out there? Any examples?
Thanks.
Yes, putting a transparent UIView on top and painting the users touches in this one is what I would do too.
Maybe this project can help you.
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
UISplitViewController Master / Detail communication
For iPad i am using UISplitViewController,for phone i m using navigation controller,i am unable to find a common way to pass object from master to detail view controller.
You're looking for what's called Delegation. Check here for my previous SO Answer and quick example , also includes a Link to Apple's Documentation on Delegates and Data Sources. Objective C View to Controller Communication
Hope this helps.
This question already has answers here:
How to send objects in NIB files to front/back?
(6 answers)
Closed 9 years ago.
I know this is simple, but i cannot get one of my object behind the other. I looked for bring to Front, or some kind of index similar to z-index in CSS. I couldn't find anything.
It is a little bit hidden, but it is there ;)
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Understanding Model-View-Controller
If I was for example building a calculator application how would I go about splitting functionality so as to follow the MVC design pattern?
Am I right in thinking the following:
View
-Contains all buttons and textfields
Model
-Contains all operations (e.g. add subtract etc)
Controller
Contains all the functions for handling operations and updating display based on user input
Essentially the model acts as a library to the controller in this instance..
If anyone can explain better please do so, but I am struggling to fully grasp the concept..
While you do not technically need to separate an application into MVC, it is more logical to do so. What you have written is essentially correct. The View is your interface to the user. It can be buttons on an iphone or a console on a computer screen. It is independent of the actual function of the application, which is generally in your model, although real basic apps might put some or all functionality in their view controller. A calculator is complicated enough to warrant an independent model class, as you have suggested. The controller is the bridge between the view and the model. So if someone presses a plus button in the view, the controller takes this and sends it to the model.
This question already has answers here:
What should my Objective-C singleton look like? [closed]
(26 answers)
Closed 8 years ago.
I want to implement singleten design pattern in iphone code
I have one array. I want it to retain its value between function calls of from single class function.
How Can I use singleten design pattern to do above task?
Thanks.
better you can initialize it in appdelegate of your project.
then you can access this array anywhere in your project.
#define UIAppDelegate ((yourAppDelegate *)[UIApplication sharedApplication].delegate)
include this in your your appDelegate, then you can access your array any where you want.
UIAppDelegate.yourArray
Matt Gallagher has a pretty good writeup, with a very simple to use preprocessor macro to set create a singleton for class:
http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html