objective-c

Model setup for data UITableView that will be filtered using a UISegmentedControl

I am making a UITableView with a UISegmented control ala the Recent Calls tab in the Phone app. The first segment will be all items, the next 2 will be subsets of the full list of items. I created 3 arrays which hold the 3 different lists of data. My first solution was a wholesale swap of the data and the a reload: [self setData:newD...

How to resolve 'unrecognized selector sent to instance'?

In the AppDelegate, I'm alloc'ing an instance defined in a static library. This instance has an NSString property set a "copy". When I access the string property on this instance, the app crashes with 'unrecognized selector sent to instance'. Xcode provides a code hint for the property, which means it is known in the calling app. The ...

unable to send mail from iphone app-(notifications.sendEmail)

hi friends, i am trying to send email to my friend using my simple iphone applicaiton, but i am getting nothing... please help me to do this... thank u very much. here is my code NSString *nm=@"[email protected]"; NSString *sub=@"test msg"; NSString *content=@"thi is test mail, by sending to own wall!"; NSD...

iPhone SQLite File management

I'm developing an application and I'm using SQLite as my database storage. I want to add and update the sqlite database throughout my application duration, so i copied it to the documents directory so i can do all kinds of stuff with my database except only selecting from it. But since I'm developing "time", my database changes frequent...

How does a category work in Objective-C?

I'm new to objective-c and need to extend a standard class of a framework with an instance variable plus accessors. I heard that this is done with a so called "category", which sounds pretty confusing to me. How does this basically work? ...

How can I find automatically the coordinates of boundaries inside an PNG with transparency?

Imagine this: I have an PNG image that shows teddy bear, or a triangle. Something non-quadratic. Now, I want to find out, at which point for a given row and direction (coordinates relativ to the UIImageView's coordinate system) the actual visible image starts. Example: Lets say, I need to know where the feet of the teddy bear begins fro...

Displaying XML tags in labels

I’m trying to parse an XML file having ‘n’ number of questions using Objective C. I have to display those questions in labels at runtime in a view. That means ‘n’ labels for ‘n’ questions and ‘n’ labels for ‘n’ answers too. Does anyone have any suggestions about how to do this? ...

How can I break out of two nested for loops in objective-c?

I have two for loops nested like this: for(...) { for(...) { } } I know that there is a break; statement. But I am confused about if it breaks both loops or just the one in which it was called? I need to break both ones as soon as I see that it doesn't make sense to iterate more times over. ...

Cross-Platform Objective-C / C++ Development

I work in a team of developers, one of us works specifically under Windows, and I work primarily in Mac OS X. We're wanting to develop C-based applications either in C++ or Objective-C however I'm not really knowledgeable in how to go about a cross-platform development project. Is it viable to work in C++ using Mac OS X? Obviously the...

How can I make an undecorated window in Cocoa?

I like to create a Cocoa window without any chrome whatsoever. The only thing the user should see is what I draw. I've discovered I can create a custom NSView but does this have to be in an NSWindow to display? If not, how can I display it without putting it in an NSWindow? If it does have to be in an NSWindow, how do I stop the window ...

iPhone: How to load a View using a nib file created with Interface Builder

Hi I'm trying to do something a bit elaborate but that should be possible, so here is a challenge for all you experts out there (this forum is pack of the lot of you :) ). Im creating a Questionnaire "component" I want to load on a NavigationContoller my QuestionManagerViewController. This is an "empty" view controller that can load di...

Objective-C: Importing headers in .h or .m?

I'm new to objective-c and would like to know the best practice for importing some external headers that I use in my class. Should I be storing the #import "classB.h" in my own classes .h file or in the .m file? What's the difference? Thanks! ...

Under what circumstances would [[NSScreen mainScreen] visibleFrame] return null?

I want to get the dimensions of the main screen, so I use this snippet: NSLog(@"mainScreen frame = %@", [[NSScreen mainScreen] visibleFrame]); It's printing mainScreen frame = (null) Earlier it was printing the expected dimensions of my main monitor. What are some possible causes of this? ...

How do I create a UIBarButtonItem with multiple "sections"?

I would like to create a UIBarButtonItem on my iPhone application which has two "sections". Basically I would like to have functionality equivalent to the 'Today', 'This Week', and 'All' buttons that's in the 'Most Viewed' section of the YouTube iPhone app. It doesn't look like this functionality was accomplished with multiple UIBarBu...

String encryption in C# and Objective c

Hi All, I am building a iPhone app which uses c# web services. My c# web services takes user details and validates against my DB and returns xml files. So Now the issue is how to encrypt user details(username and password are 10chars each) in objective c and decrypt in C#. I am very new to cryptography, which method is the best. will ...

Conditional compile when running in Simulator as opposed to on a device

Is there a compiler directive I can use to compile a different line of code when targetting the simulator as opposed to my device. Something like: # IF SIMULATOR [self.imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary]; # ELSE [self.imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; # END EDIT D...

How do I fix my application from leaking when using Qt 4.5?

Without any changes to my code except building against Qt 4.5 I get the following warning message when I run my application: *** _NSAutoreleaseNoPool(): Object 0x50a1b0 of class NSCFNumber autoreleased with no pool in place - just leaking I am not using any Objective-C in my code but Qt 4.5 is using a new Cocoa based back end instead ...

iPhone SDK: Checking the ID number for each object in a UITableView and change the badge number accordingly

Hello there! I'm tryin to use some code to create a badge number for the iPhone App Icon. I can successfully do this, however the code I am using (below) is pretty bad and could easily be done better, however I do not have the logic knowledge to be able to do this. This is what it's doing... Get's the 'ID' of a user from the first me...

What kind of data is size_t holding?

In a code-snippet I have seen this: size_t w = CGImageGetWidth(inImage); The docs don't give me any useful info about "size_t". Does anyone know what this is? ...

What's this {{0,0},{w,h}} doing?

I stumbled upon this piece of code today: CGRect rect = {{0,0},{w,h}}; Here, I would have used a CGRectMake. But what does this thing in rambled brackets do? What kind of special-syntax is that? None of my objective-c books ever mentioned that. ...