objective-c

Objective C "do - while" question

The example for one of the exercises in the book I am reading shows the following code: #import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int input, reverse, numberOfDigits; reverse = 0; numberOfDigits = 0; NSLog (@"Please inp...

what do all the +'s and -'s in Objective-C mean?

in function signatures, like: - (void)dealloc ? thanks :) ...

iPhone app always crash while using 3G

My application always crashes if I use the camera to take a picture while connected to a 3G connection (not wifi). When I use wifi then it run perfectly. What is this problem ? ...

Objective-C why doesn't my array of array works?

This is probably a completely stupid question, but i'm pretty new at objective-C and programing in general. i'm trying to make an array of arrays but can't manage to make it work : @interface ArraysAndDicts : NSObject { NSMutableArray * mySimpleArray; NSMutableArray * myComplicatedArray; } the implementation : -(void)generateValueF...

Change classes instantiated with loadNibNamed

I am trying to change the class of objects created with a nib with the iPhone SDK. The reason for this is; i dont know until runtime what the class is that i want the nib object to be (though they will have the same UIView based super class), and i dont want to create a different nib for every eventuality - as the .nib will be the same ...

How to hide UIStatusBar and show UINavigationBar at the top when UIView changes to LandscapeOrientation

I am using two views (portraitView and landscapeView) loaded from xib in a viewcontroller for different InterfaceOrientation each for Portrait and Landscape mode. The view in portrait mode has statusbar and navigationbar and other one has just the navigationbar. The problem is that even i made statusbar hidden programatically the view in...

NSThread running a class

Hi, Every the example I find on the internet (including Apple doc) sets the target to self like this : [NSThread detachNewThreadSelector:@selector(threadedTask) toTarget:self withObject:nil]; Since i would like to do a more complex task in background (involving multiple methods), I thought of creating a class Task called like this : ...

How to Call drawRect programmatically in objective c

How to Call drawRect programmatically in objective c ? I want to call drawrect method of a view in my UItabbarcontroller. How i can do this ? Thanks in advance.. Edit I have to call when the view is not visible currently. It will be the first time i have to call that view ...

UITableView like Contact App

Hi, I try to create an UITableView similar to the Standard Contact App, when selecting a contact (i.e. grouped style). But how do I get some controls at the top or at the bottom of the cells, which scroll with the rest? In the Contact App you have at the top the picture together with the name and at the bottom three buttons. Are these j...

How to set the title as left alignment in the UIButton.

Hi Guys, I need to dispaly the email address from left side of a UIButton, But it is getting in the center. Is there any way to set the alignment to the left side of a UIButton. UIButton* emailBtn = [[UIButton alloc] initWithFrame:CGRectMake(5,30,250,height+15)]; emailBtn.backgroundColor=[UIColor clearColor]; ...

How can I discover what apps are installed on OS X using Objective C or Macruby?

Hi, could you tell me please - which object and which method can i use to fetch information about installed applications on OSX with objective c or macruby? ...

Declaring CustomViewController?

I have noticed in some of my older apps that in situations where I have added a custom View Controller I have not changed the View Controller class in the application delegate. For example, below I have created a CustomViewController class but have declared viewController as UIViewController. @interface ApplicationAppDelegate: NSObject ...

what do you expect from flash in the near future?

The recent article of steve jobs link made me think about the future of flash. I'm learning actionscript 3.0 in my studies but is it the right decision still to go for it? I was pretty sure that I will be able to build application in as3 for iphones/ipads in the near future. It seems to me, while I would stay with flash, the market will ...

Where to #include?

In my past applications I have been #importing into my *.h files where needed. I have not really thought much about this before as I have not had any problems, but today I spotted something that got me to thinking that maybe I should be #import-ing into my .m files and using @class where needed in the headers (.h) Can anyone shine any li...

Why do they initialize pointers this way?

In almost all of the books I read and examples I go through I see pointers initialized this way. Say that I have a class variable NSString *myString that I want to initialize. I will almost always see that done this way: -(id)init { if (self = [super init]) { NSString *tempString = [[NSString alloc] init]; self.myS...

Why my image is up side down?

This is my drawInContext method: UIImage *img = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"myImage" ofType:@"png"]]; CGRect cropRect = CGRectMake(0, 0, 175, 175); CGImageRef imageRef = CGImageCreateWithImageInRect([img CGImage], cropRect); CGRect imageRect; imageRect.origin = CGPointMake(0, 0); imageRec...

was unable to load a nib named "TwitterDrilldownView"

Hi, -[UIViewController _loadViewFromNibNamed:bundle:] was unable to load a nib named "TwitterDrilldownView" I get the above error when I push a new ViewController onto the navigation stack. This is the push code, [self.navigationController pushViewController:[[[TwitterDrilldownViewController alloc] initWithTwitterAnnotation:temp] aut...

Dump UIImage on iPhone

I wonder how to save the UIImage object from UIImagePickerController into the App Document directory. I tried to use UIImageJPEGRepresentation() method and UIImagePNGRepresentation(), but it seemed the image data was changed. Is there any method to keep the original image content without any compression? ...

CoreData and many NSArrayController

In my CoreData Application, I've an outline view on left of main window, acting as source list (like iTunes); on the right I display a proper view, based on outline selection. Each view has its components, such as table view, connected to array controller, owned by the specific view. Very often different views display same data, for exam...

http authenitcation in Xcode

I am trying to make Twitter work in my app and everything works fine except the code does not seem to recognize an error from Twitter. If the username/password are not valid, I get an error message through this function: - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { NSString* strData = [[[NSString al...