Objective C: How to implement undo button? - iphone

I am using Core Graphics for my Paint App school project and i want it to have an undo button
but i don't know how, it's my first time to get this close to Objective C, any help?
i already have the button connected to its outlet and sent event, the code now is my problem.
thanks in advance!

You need to read up on NSUndoManager.

I didn't clear your question ,my assumption is when you pain with some colors in the view,you have to undo right?so you want to code cancel the last touch event of the view.The basic idea is cancel last touch.You can code it in tozuchevent delegates and call by that cede in button.

Related

Objective-C: Trigger method with computer keyboard stroke

Sorry if the questions is asked/answered already, or if my title is poorly worded.
I am currently writing an iPhone app, and have considered a useful tool for debugging. I would like to write a method that just prints variables and other info that I want. That part is simple and all, but I want this to be called by keystroke.
For now I have been just adding NSLog()'s to viewDidLoad or to other button methods to check if my variables are being set properly, but it's becoming tedious and the code is long so I tend to forget about some and spend a lot of time looking for them haha.
I just want one method that I can go to to write my NSLog()'s, and have that method call whenever I hit 'space' or something of that sort.
Can this be done?
Thanks!
-SF
It's pretty hard to do, you need to have a hidden text field that you keep in focus, hide the software keyboard for it, then listen on its delegate methods for changing text.
An alternative would trigger the code inside applicationWillResignActive: which gets called on application hiding, notification center showing, or double home press.

SegmentControll problem in iphone

A new bie here...
I am using a segmentController..in that there are three segments...Say segment A,B,C
Now I want this functionality...
when I press Segment A..Table A comes up..
when I press Segment B..Table B comes up..and
when I press Segment c..Table C comes up
well I know all the label change and that stuff...but what about the tables?? and again when I press the row elements they navigates me to another views and I want segment control to be displayed in navigated view also..
well ... can anyone please tell me how to do this??
any suggestion..any tutorial..any example code...any logic...anything....:)
Here is the link shows the simple Segment control. And when you want to add a Table , it is having the sample process , connect the delegates and data source. HERE is the descussion on the kind of similar question as your one.
This is the Class Reference of Segment control, which provides you a lot many examples this shall help you.
Hope this will help you.

What is the use of undo manager? How to use it?

What is the need of undo manager in iphone? I never see such buttons in sample programs. I know the meaning and the use of undo & redo. But my question here is, For which purpose, i need it? How to use it in my application? Also suggest a good example code link if you know...
Thank you
Undo is used in many apps, including most or all of the Apple built-in ones wherever text editing occurs. Type or change some text in Mail or Safari and then shake your phone; you'll see an AlertView pop up asking you if you'd like to undo your text change.
There's a pretty good tutorial here:
Mobile Orchard: Shake To Undo/Redo, NSUndoManager

hold down button to delete

Well, I cannot seem to find this anywhere on the site. So here is my question.
I have a test app which creates multiple buttons and gives each one a unique name via "+" in the toolbar. So far so good.
I am trying to find a way to press down on a button to get that Apple Jiggly effect and then delete that button and all subViews and data related to it.
Can anyone Please show me the way here?
Thanks,
Will...
Look at three20's TTLauncherView for an example of how this is done.
API: http://api.three20.info/interface_t_t_launcher_view.html
Code: http://github.com/facebook/three20 (specifically, the TTCatalog which has the TTLauncher in it)
You would have to implement deleting the subviews and data yourself after they hit the delete X box.

Assigning Back button event to form button in android

i have a form button in the form,which i need to perform basic action performed by the back button in the android emulator.
I know the key even is KeyEvent.KEYCODE_BACK
how to assign this to my button.
thanks in advance.
The question isn't totally clear, but you probably just want to call finish() when your Button is clicked.
I found the solution to it.
call the function moveTaskToBack(true);
to get back to previous task.