objective-c

Is it possible to add Notification Center to a cpp class in objective-c++

Hi All, I would like to add notification center from a cpp class, is it possible???? if Yes how to do it. Manager.h class Manager { Manager(); }; Manger.mm file Manager:Manager() { [[NSNotificationCenter dafaultCenter] addObserver:self selector:@selector(workermethod) name:@" Name" object:(id)nil]; } My compiler gives an error...

How to get a PID for a specific app in iphone?

Hi All, How can I get ProcessInfo of a particular app (Not the same app/process)? I know that "NSProcessInfo" gives the details of the current process. But I would like to know is there any way to get the info of particular process say for example "Mail". If Mail is running in background, how can I get the info of it? P.S: Requirement ...

Creating or popping up a dialog in a Thread from nib file in cocoa

Hi All, I need to create a dialog from a thread. Im loading a nib file within the thread using the "initwithwindowNibName" and trying to popup the dialog using "[nsapp runmodalforwindow]",but the dialog is not popping up.. Please help me out. ...

display text with many clickable URLs

Hi, I'm using custom NSCell in NSTableView similar to: http://www.martinkahr.com/2007/05/04/nscell-image-and-text-sample/ I wish to display text with many clickable URL. can any body throw me in tight direction? I was trying to do something like: http://snippets.aktagon.com/snippets/358-How-to-make-a-clickable-link-inside-a-NSTextF...

Delete All Rows in a Table View with Objective-C

Hi everyone! I'm looking for a way to delete all rows of an NSTableView. The table view has a data source but it isn't set as a variable so if I need a data source, I have to have something like "data source of tableView" to access it. Thanks in advance. ...

Why am i getting a EXC_BAD_ACCES

Hey. I have been working on a Twitter application and have been stuck on a EXC_ BAD_ ACCESS error for quite some time. I know that EXC_ BAD_ ACCESS is a memory issue but i cannot pinpoint where the problem is. Here is my code sample: - (void)viewDidLoad { [super viewDidLoad]; NSString *path = @"/Volumes/Schools/BHS/Student/740827...

Xcode Error "Couldn’t load the next page."

It's really not my day, I was about to create a new class in Xcode (Version 3.1.4) so I went to (right click) Add > New File... selected Objective-C Class and i got the message "Couldn’t load the next page.". Anyone? Thanks in advance... ...

How to compress data using zlib

Is there a class that allows to compress data with zlib, or the only possibility is to use directly zlib.dylib? ...

Getting in-app email's subject and message

I've added in-app e-mailing with the MFMailComposeViewController class and it is working well. I'd like to save what the user enters for the Subject and Message and reload this information the next time the user launches in-app email on the chance they want to re-use their Subject or Message. I haven't found any methods to save this da...

Objective-C: navigationController pushViewController & NIBs

Hi guys, I have some issues with pushViewController. Essentially so far I have a class (UIViewController) that is essentially a UITableView (i have delegates for UITable) and it shows the UITable fine. Now I want this to be a hierarchical table that goes down to another controller... Problem is, prior to me making this change, the NIB ...

NSMutableDictionary setobject giving "message sent to deallocated instance" error

This line of code: [mymutabledict setObject:myclassobj forKey:myclassobj.myidstring]; Is giving this error: *** -[NSCFString hash]: message sent to deallocated instance 0x3c14610 I put in a breakpoint on that line and I've checked and all 3 objects (mymutabledict, myclassobj, and myclassobj.myidstring) are correctly allocated and ...

What class to subclass - NSView or NSButton

I am creating a button and should I subclass NSView and or NSButton? ...

Changing the fill to a already drawn NSBezierPath

I'd like to change the fill of a button that I've drawn (I subclassed NSButton) Here's the code I've got already: - (void)drawRect:(NSRect)dirtyRect { // Drawing code here. // Create the Gradient NSGradient *fillGradient = [[NSGradient alloc] initWithStartingColor:[NSColor lightGrayColor] endingColor:[NSColor darkGrayColor]]; // Creat...

Objective C: How to kill a thread while in another thread in Objective-C?

I was trying to set up a multi thread app. One of the threads is working as background to get some data transfer. Right now this thread automatically kill itself after it's job done. Somehow I need to kill this thread in another thread in order stop its job immediately. Are there any api or method for making this happen? ...

add text to UITextField at desired location

Hello, Hello, I am quite new to iphone development. I have a situation here. I have some labels which can be dragged across the screen. When any of these labels are dragged to some textfield and released over a textfields UIlabel test is assigned to that text field. Now the problem is this I want to assign the text of UILabel to some...

Setting the UI Labels of NSTextfield dynamically in cocoa

Hi All, I need to set the labels of the UI dyanmically.. I want be read the text from an xml file and would like to set the text to the controls in the NIB. I guess i can recognise the conrol by using the TAG attribute of the control. Now i would like to get all the objects in the window(controls in the Nib) into an array? Please sug...

Retrieve data from web-site database+how to

I have made some project When people put a keyword into UITextfield and click the button--->then my app will retrieve data from web-site database. But I have spent so much time to find out what is wrong because it did not work look at the code here: - (IBAction) btnClickMe_Clicked:(id)sender { NSString *kw = s.text; // <-----THI...

Exception with TabBar in iPhone SDK

Hello! A friend gave me a small tutorial to iPhone programming yesterday. I then tried to make a small program with two views which I can switch using a TabBar: One with a blue background, one with a red one. It displays them just fine, but when I run it (in the Simulator) and click on a Tab, it crashed with : "Terminating app due ...

NSNotificationCenter vs delegation( using protocols )?

What are the pros and cons of each of them? Where should I use them specifically? ...

Calculating the max value for a core data attribute - NSCFNumber error

Hi, I need to find out the maximum value of an attribute of a core data entity. I'm still firmly in the Cocoa learning curve, and this is a simple test app that I'm using to learn. The app imports fortunes from a text file and displays a table on the screen. The imports are done in a separate, background thread. I found this code onl...