Does anyone have any suggestions for an 'Apple Sanctioned' way to change behaviors (ie, showing specific pictures in an imageView) based upon which segment within a UISegmentedControl is selected? Should a case or switch statement be used?
Forgive the possible obscenely obvious question, but I was instructed that if you need to use a sw...
I'm trying to find a way to get an NSImage (or CGImage or CIImage, I'm not picky) containing only the visible rect portion of an NSTableView.
I've tried this:
NSRect visiblePart = [someTable visibleRect];
NSImage *tableImage = [[NSImage alloc] initWithSize:tableFrame.size];
[tableImage lockFocus];
[someTable drawRect:visiblePart];
[ta...
I'm new to iPhone development, and I've just run my iPhone app throught the Intruments Leaks tool for the first time, and discovered a leak with my ListViewController dataArray method.
When I click on the listing it shows the code, and a few lines have percentages next to them. Presumably they're the lines that are leaking memory. I've ...
There are two classes, let's call them Class A and Class B.
Also, in class B, there's a NSMutableArray called arrayB.
@interface A {
// for reference functions in B
B *obj;
}
@property (assign) B *obj;
- (void) addObject: (id) objectB;
And I access B by calling:
obj = [[B alloc] init];
Here's definition of B:
@interface B...
Hi,
I am copying a SQLite file to the "Documents" directory of my iPhone/Simulator.
First I deleted the app off my phone and from the simulator and the app folder disappeared in "Application Support / iPhone " folder.
I made changes to the structure, deleted old version and copied new version to my "Resources" folder. Restarted my ap...
I've got a CIImage with an alpha channel. Big portions of it are fully transparent. I'd like to find the minimal axis-aligned bounding box containing the full nonzero-alpha region, and crop the image to this bounding box. Similar to the "auto-crop" feature in GIMP.
How should I proceed?
...
Hi,
I am trying to compare if one NSString is "greater" than other NSString and I am stuck. Actually, my NSString contains a date and want to get all these objects that are greater than it.
I know I should convert it to date, but I want to keep it as NSString.
Thank You!
...
When I was reading about the new 4.0.2 iOS update I wanted to know what hackers do or try doing with a buffer overflow, which after some wikipedia'ing got me interested in playing with malloc and thus creating my own "NSObject".
I am not actually planning to use this in any of my applications, its only for learning and playing around wi...
I have
-(void)requestFailed:(ASIHTTPRequest *)request
{
NSError *error = [request error];
NSLog(@"Request Failed Error: %@", error);
}
When I make my request I do
//add data to the array
NSString *json = [array JSONRepresentation];
[request appendPostData:[json dataUsingEncoding:NSUTF8StringEncoding]];
[request star...
Hi all,
I'm looking for a nice clean routine for turning an NSArray containing NSNumbers (integers) into a nice English-readable string. For example, I want to change this:
[NSArray arrayWithObjects:[NSNumber numberWithInt:5],
[NSNumber numberWithInt:7],
[NSNumber numberWithInt:12],
...
@protocol Runnable
- (id<Runnable>) works; //this compiles fine
- (Runnable *) broke; // get a compile error saying Expected ')' before 'Runnable'
@end
I'm not sure I understand why xCode complains about the - (Runnable *) broke; line
...
Hi,
Was just wondering, which way is better to fully initialise an object:
NSString *myString = [[NSString alloc] init];
OR
NSString *myString = [NSString new];
thanks
...
I'm trying to match usernames from a file. It's kind of like this:
username=asd123 password123
and so on.
I'm using the regular expression:
username=(.*) password
To get the username. But it doesn't match if the username would be say and[ers] or similar. It won't match the brackets. Any solution for this?
...
I'm trying to use only a NSDateFormatter to format string representation of a date/time to an NSDate object. The issue is that I can't figure out how to allow the ordinal suffixes in the format.
So lets say I have a string
"Wednesday, August 11th 2010 8:00 PM"
What one line NSDate dateFormat should I use?
Like "EEEE, MMM dd'th' yyyy ...
[New to Objective-C, struggling with things that are straightforward in other languages.]
I would like to do something like this:
@interface GameBoard : NSObject {
// ..
GameState *parentGameState;
}
- (GameBoard) initStartGame (GameState *) parent;
so that a GameState (which has a GameBoard pointer as a member) could create a G...
I am creating a delegate view controller and presenting it to the user to perform an action but I would like to change a NSString on the delegate view controller based on the originating view controller. For example if the delegate view controller is a delegate of viewControllerA, then display Foo, but if its a delegate of viewControlle...
Ok, I'm totally new to obj-c + cocoa, so this is probably obvious, but here goes:
I've been moving from command line apps to cocoa apps in learning how to work with objective-c in Xcode. One thing I don't really understand is the role of the AppDelegate and how it connects to main.m
It seems like you could put your entire program in th...
Hi, everyone,
I want to ask a question about the objective C. When I study the library from the apple developer website. I always see that there are some subclass called "mutable". For example, the NSArray and NSMutableArray. What does it mean about this word. Are there some special meaning? Can anyone tell me? Thank you.
...
Hi, everyone,
I want to ask a question about the objective C. I want to download a .vcf file from a server (CardDav server) in iPhone application. After I read the API and library of the Apple Developer, I found that I should use the NSURLConnection Class. However, I don't know how to start the program.
Therefore, I want to ask can any...
Hey guys,
I want to store a couple of sockets in an ArrayList/NSMutableArray, but the sockets are of type int and NSMutableArray only accepts objects (id). Is there another data type that I can use as a container for sockets? I am not sure how many entries I will have, so I would like the data container to be like an ArrayList.
Thanks!...