Adding a custom pop-up in Cocoa Touch - objective-c

Im trying to add a custom pop-up, I dont want to use the Alertview class, I want to make a personalized pop-up, with only two buttons, ok and cancel, and to capture those events to use them later.
Im new to objective-c, what is the best approach to do this? (a working example would be better than nice)
Thx.-

Here are a few examples with projects:
CustomAlert
Another SO Question

Related

Best way to only get some functionality from TextEdit for NSTextViews

I'm new to objective-C and I'm not sure what's the best way to finish my current project. Basicaly, my project is a plugin for a medical software and it has as inputs 2 NSTextViews. I've tried to manually implement all the functionality of a text editor but some futures seem impossible for me to implement. My question is, what is the best way to get this functionality: TextEdit Funtionality for my NSTextViews ? Is there a better and/or easier way from doing every button and every action regarding text editing ?
Check the documentation for NSTextView, specifically the section "Using Text Formatting Controls".
The properties rulerVisible and usesInspectorBar will enable the functionality in your screenshot.

How can I make a copy of an already created window?

So I am making an xcode application for OS X, and so far things have gone well. However, right now I am at a roadblock. My app is mostly one window, and I need that window to be created multiple times, in the way that apps like Safari, TextEdit, and all those ones have the File>New function. I am new at Xcode, and I was wondering if there was an easy way (hopefully 3-4 lines of code) to do this. If someone could explain that to me that would be great.
Thanks!
Start a new OS X project and choose "Create Document Based Application" . This will create a NSDocument subclass.
If you want to use Core Data , choose that also. This will create a NSPersistentDocument subclass.
This will give you the basis of your application with all the functionality you ask for.
Have a look at Document Based App Programming guide and NSPersistentDocument Class Reference
Whatever you do, dont try to bake your own. There lies madness.
The project template sets up the info.plist correctly to make this work.
Whatever I tell you, it won't involve only "3-4 lines of code," unfortunately.
If you're working from a non-document-based application, you'll want to factor out the code that creates your one window. If you're not using a window controller in concert with your window, you should implement one. Then you can implement an action that will create a new instance of your window controller, and so a new window. Of course, you'll need to add more infrastructure if you're interested in saving information associated with a window to a file.
Which leads me to your other option, which is to create a document-based application. The big advantage here is that, if you're interested in saving the window contents to a file, the infrastructure for doing so is provided. This involves starting over to some extent, but since you've already got the guts of your application working, you'd simply transfer those guts to the document subclass that is provided for you. You'd also need to provide to your project meta information describing the kind of document it is, including the file extension describing it.
Best wishes to you in your endeavors.

Creating an if statement for a checkbox in an OSX app

I'm trying to add a working checkbox to the welcome window of my OSX app.
I have already added the checkbox to the app in Interface builder.
I would really appreciate if someone could help me with writing the IF STATEMENT for a CHECKBOX in an OSX project.
I need the checkbox, which is on a welcome screen type window, to be selected when the app is opened (already done). When the checkbox is deselected by the user, when the app is run again, the welcome screen should not appear.
I have already sorted out writing to and getting the preferences, I just need to write the proper if statement and I can't quite get it right.
I do not want links to UIButton stuff (that is IOS!) and I do not want links to iPhone tutorials, etc.
I need help with OSX coding! Please! Would be very much appreciated.
Use Cocoa bindings.
Bind the value binding of the checkbox to some key on the Shared User Defaults Controller. The logical place to store simple preferences would be NSUserDefaults.

How to dynamically add fields to a NSView similar to iCal New Task popup?

I'm trying to implement a NSView which will host a 'choose file' attachment button. If the user chooses to add a file, the user will be given an option to add another one (and from the 'new set of dropdowns' the user will essentially be able to pick the kind of file they're attaching').
The closest match to this functionality is iCal's New Task editor where you select an alarm and then it gives you an option to add another alarm right underneath.
What is the right way of doing this (I'm new to Mac OS X development)? I originally thought I'd create a custom NSView with all the 'file options' and then if the user was to attach a file I'd dynamically add another NSView right below it (in a NSScrollView). However so many apps do something similar that I almost feel as if there's something else out there in the set of controls that I should be using.
Please can someone guide me to the right direction? Is 'NSForm' or NSPredicateEditor used for this sort of stuff? This is what I mean:
Neither NSForm nor NSPredicateEditor would be useful for what you want to do. I think your thoughts about how to do this by adding a custom view below the original view, is the right way to go. You don't necessarily have to do it in a scroll view, you could expand the size of the window like iCal does.

Multiple windows or "pages" in an application

I am a newbie in Mac application development. I want to write a GUI application in Cocoa using Interface Builder. I want multiple screens i.e. when one button on a screen is clicked, another screen should be displayed. How can I activate a new screen at button click event?
I would heartily recommend Aaron Hilegass's book Cocoa Programming for Mac OS X. It took me from feeling like everything was impossible to being relatively competent in the space of a few short weeks. I was very impressed with it.
Apple's documentation is amazingly good, but it takes a while to get used to the style, and you will need to know which objects actually exist before you can look up how to use them, which is where Aaron's book comes in.
Your library may have a copy of it, or be able to order one for you if they don't.
I think you mean windows, not screens. Screens are the displays (monitors) on which all the user's windows from all the user's applications appear.
And I second Jonathan's recommendation of the Hillegass book.
The button has a target. That should link to the new window. As its action you can tell the window to show itself.
Take a look at:
http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/WinPanel/WinPanel.html
I think what you want is the type of interface like that seen in Coda, or System Preferences where there is a toolbar on the top of the screen that can be used to select between the content of the window.
The simplest method I have found is to use BWToolkit.
Another method is to use a series of views, and switch between them when the toolbar is clicked. I've found one description here, but that's not the one I used first (which may have been originally in Ruby Cocoa, IIRC).
NSTabView.