objective-c

How objects in Autorelease pools are handled in Objective-C?

Hi, My question is when a object is actually added to autorelease pool? When a Autorelease pool is created and objects are declared within the scope, are they added in autorelease pool or they are added in pool when specified as autoreleased. int main(void) { NSAutoreleasePool *pool; pool = [[NSAutoreleasePool alloc] init]; ...

Protect iPhone app from hackers

I'm developing some iPhone application and I'm very frustrated when some of my applications published on hacked app resources. And anyone can install those apps for free. So my question is: How to protect application from dumping into memory, running in debug mode and making hacked ipsw bundle? Is there source examples for that? ...

Can we disabled the navigation controller of leftBarButtonItem that is back button of the view controller in iPhone?

Hi Guys, I want to disabled the default back button of navigation controller self.navigationItem.rightBarButtonItem.enabled = NO; self.navigationItem.leftBarButtonItem.enabled = NO;// not working how can we disabled here. I have done it with manually shown below, But Is there any property to disabled the default back button with just...

App crashing inserting object into Array

here is the code NSString* favPlistPath = [[NSBundle mainBundle] pathForResource:@"favs" ofType:@"plist"]; NSMutableDictionary* favPlistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:favPlistPath]; favArray = [[NSMutableArray alloc] initWithCapacity:100]; for(int i=0; i<[favPlistDict count]; i++) { //app is crashing her...

Problem with upgraded project from iphone sdk3.2 to work on sdk4.0...

I had a application that was written for iphone SDK3.2 and now I want that application to be upgraded to full fill multi tasking... I just compiled it to SDK4.0 actually it has to get upgraded and when the home button is pressed it should 1st go to applicationWillResignActive and then it should goto applicationDidEnterBackground but my ...

Using triangle as clipping area results in unwanted diagonal line

All, I have a square region where I have two 45 degree triangles that are opposite of each other (i.e. mirror image). I've created a CGMutablePathRef for each triangle so I can use that as my clipping path when drawing an image. The problem is that I am getting a diagonal line in the resulting image that divides the two triangles. Ho...

Memory leak at UILabel in Iphone sdk?

Hi guys, Here Im getting the memory leak in the label and I kept all the releases for it eventhough it showing leak at the same place. I written code in cellForRowAtIndexPath as: UILabel *textView = [[UILabel alloc] initWithFrame:labelFrame];//It showing the leak at here. textView.backgroundColor = [UIColor cle...

iPhone play sound and also vibrate problem

Hello guys! Here's my code to play sound: NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Feel" ofType:@"mp3"]; NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath]; AVAudioPlayer *_audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:nil]; [_audioPlayer prepareToPlay]; _audioPlayer.numberOfLo...

Objective-C XML: How to get the value between two tags?

Hello. I'm trying to figure out how to get the value between two tags of an XML text that is being parsed in objective c. For example, if you have: <tag>thetext</tag> I want to be able to get thetext This seems impossible with the NSXMLParser class or its delegate. Any help would be appreciated. Thanks! ...

Multidimensional arrays - what's the most convenient way to work with them in Objective-C?

I'm a beginner in Objective-C and I'm trying to find the most convenient way to work with multidimensional arrays in Objective-C. Either I am missing something or they are very ugly to work with. Let's say we have a classic problem: read input from file; on the first line, separated by space(" ") are the width and height of the matrix...

how can i integrate ticker in iphone application

hi.. i want to run my view based window application with ticker.i have code for ticker but it is in cocoa.. so how can i integrate cocoa application in my project.? this is TickerView.h file #import <Cocoa/Cocoa.h> @interface TickerView : NSTextView { @private NSTimer *mTimer; double mOffset; } - (NSString *)stringValu...

What is forHTTPHeaderField:@"Content-Type" in objective C

Hi, everyone, I want to ask an question about the objective C. What is "content-type" in the NSMutableURLRequest? Is it related to the header field as I see the forHTTPHeaderField? Also, what is the different between the following statement? // statement 1 [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Co...

How to pass the cookies from GET to POST on iPhone

Hi, everyone, I want to ask an iPhone application, it is about the adding cookies of GET and POST in NSURLRequest and NSURLResponse. In my program, the user has to enter uesrname and password. After entered the information, the user will press a button. When the user presses the button, the program will call a function 'pressLoginButt...

NSString get 100 characters from start

How to get a substring from NSSTring from index 0 to 99. i.e. first 100 characters ...

App skeleton with UINavigationController outside of AppDelegate

Hi Still a newbie when it comes to navigation controllers I have ran into a problem I cant solve for my iPhone App. Instead of trying to solve current issues with too much code in too many files I thought I would take another approach. What I want is a something similar to a tabBarController, but without the tab bars as they take too m...

what do mean by “Cocoa” in iPhone application

Hi, everyone, I want to ask an very basic question about the iPhone application. what does mean of the the 'Cocoa' in iPhone application? Is there are relateionship between the memory management and the Cocoa? thank you very much. ...

finding a number in array

I have an Array {-1,0,1,2,3,4...} I am trying to find whether an element exist in these number or not, code is not working NSInteger ind = [favArray indexOfObject:[NSNumber numberWithInt:3]]; in ind i am always getting 2147483647 I am filling my array like this //Loading favArray from favs.plist NSString* favPlistPath = [[NSBund...

how to compress image programmatically

Hi all, I am receiving images from xml feed they are very large in size how can i compress them before displaying them in table-cell. my code is int blogEntryIndex1 = [indexPath indexAtPosition: [indexPath length] -1]; imgstring=[[blogEntries objectAtIndex: blogEntryIndex1] objectForKey: @"image"]; NSURL *url = [NSURL URLWith...

slider(ticker) in iphone

hi.... friends please help me from this condition I want the bottom slider like ticker which run it self for that i tyep the code but it run with touch event (but I want this move it self ) the code here this for SlideMenuView.h file @interface SlideMenuView : UIView <UIScrollViewDelegate> { UIScrollView *menuScrollView; UIIma...

How to tell how may unique elements there are an NSArray

I've got an array (actually a mutable array) of NSStrings, and I want to find out how many unique elements the are in the array. For instance, say the array is made up of: Orange, Lemon, Lemon, Orange, Lemon Then there are just two unique elements (Orange and Lemon). And this array: Paul, Steve, John, Harry, Paul, John ..has four ...