My first instinct is to
FooType *myFoo = nil;
for (id obj in myArray) {
if ( [obj isKindOfClass:[FooType class]] ) myFoo = obj;
}
With all the goodies in Objective-C and NSArray, there's gotta be a better way, right?
...
Hi Guys,
I met a problem in XCode. And my problem was similar to this one: http://www.iphonedevsdk.com/forum/iphone-sdk-development/40121-expected-specifier-qualifier-list-before.html
So I want to know how to solve the problem in the link above?
Thanks in advanced!
Nick
...
I'm looking for high-resolution timing code for iPhone, in order to do some performance timings. I'd like to write code like this:
HighResolutionTimer* myTimer = [[HighResolutionTimer alloc]init];
[myTimer start];
[self doSomeLengthyOperation];
NSLog( @"doSomeLengthyOperation took %f seconds", [myTimer elapsedTime] );
...
HI Guys,
I tried using facebook API but once i tried integrating it. I noticed that the login form which displays the login form of facebook is so huge that causes it not to fit the whole login window of iPhone.
Anyone have an idea how fix this one?
Thanks
ZaldzBugz
...
Dear all,
Hi, I am a newbie of xcode and objective-c and I have a few questions regarding to the code sample of a game attached below. It is written in objective C, Xcode for iphone4 simulator. It is part of the code of 'ball bounce against brick" game. Instead of creating the image by IB, the code supposes to create (programmatically)...
I'm creating easy to use kannada comic reader on mac for my cousins. I'm able to pull the comic pages, but lot of meta content exchanged webpage and server using XMLHttpRequest.
I'm finding difficulties use XMLHttpRequest, could anyone tell me how can I use it?
...
Hello,
I'm working on an app for my client. I'm stuck now.
I don't know how to explain. But i make a photoshop image of it.
http://i.imgur.com/cV4mL.jpg
user tap on parent tablecell.
execute didSelectRowAtIndexPath:(NSIndexPath *)indexPath. User select cell.
parent cell update.
Anyone know what is this called?
Do you have tutoria...
Hi, everyone, i have no idea why this doesn't work hopefully someone here can help me out.
Here's what i'm trying to do:
I've got two ViewControllers, lets call them secondViewController and firstViewController.
The firstViewController is shown when the application starts and it pushes the secondViewController.
Inside the secondViewCon...
Hi,
I am adding two CAText layers to a view and animating one of them. I want to animate one layer above the other but it doesn't get positioned correctly in the layer hierarchy until the animation has finished. Can anyone see what I have done wrong? The animation works, it is just running behind 'topcharlayer2' until the animation has ...
Hi,
I am trying to learn Objective-C and have run into a problem with pushing a new View controller when a Button is clicked.
I have a switch View Controller that is responsible for pushing the settings.nib file when I press the settings toolbar button. Here is the code of the ViewController:
//
// ViewController.h
// iReader
//
// C...
I need to basically do a "sudo" but, I need to give that kind of permission to my NSTask code. Is this possible?
Thanks,
Elijah
...
Hi guys,
I want to make an iPhone app which communicates with iChat on Mac OS X via Bonjour. I have already known how to create a service using NSNetService, but how can I communicate with iChat? What service type do I need?
Any help would be appreciated. Thanks in advance!
...
so i am getting an uncaught exception and im not sure why. this is the error i get:
2010-08-22 10:39:25.080 MayanGlyphs[10903:207] * -[UILabel setAnswerText:]: unrecognized selector sent to instance 0x4916830
2010-08-22 10:39:25.081 MayanGlyphs[10903:207] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ...
Dear all,
i am trying to add splitview into my project code.
I understand that most of the SplitView project have their splitview loaded on the main window.
but i need to have other views before i come to the split view. That's the reason that i added split view to one of my view controller.
i have successfully added my split view.. ...
-(void)LoadOriginalListFromFile
{
NSMutableArray *temp;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"shopes.dat"];
//2.check if file exists
NSFileManager *fi...
I'm using openURL to send an email w/some links. The function looks like this:
//
+ (void) sendEmail:(NSString *) subject withBody:(NSString *)body {
NSString *mailString = [NSString stringWithFormat:@"mailto:?@&subject=%@&body=%@",
[subject stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
[body stringBy...
From a related thread, how should I have known the "mailString" below was already autoreleased?
//
+ (void) sendEmail:(NSString *) subject withBody:(NSString *)body {
NSString *mailString = [NSString stringWithFormat:@"mailto:?@&subject=%@&body=%@",
[subject stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding],
...
I have several custom UIMenuItems that do things with a selection in a UIWebView. After the action has been run on that selection I want to hide the selection handles just as copy: does.
I have tried using window.getSelection().removeAllRanges(); and that works in that window.getSelection() no longer returns anything but the text selec...
As os 3.2, we are allowed to change the editing menu. This is what the documentation states:
"You may create your own menu items, each with its own title and action selector, and add them to the editing menu through this property. Custom items appear in the menu after any system menu items."
I would like to remove those 'system items'...
Hi, is there an OR function in Objective-C?
for example:
if(string1 == string2 || string3 == string 4)
|| doesnt seems to work.
Thanks.
...