objective-c

Align UIViews to left

Hi, i want align UIView's to left, like the property align="left" in html or float:left with css, it's possible in objective C? Note: the UIViews are dinamically loaded (i dont know how many) ...

NSThread, how to call a method with 2 param's

Im trying to use NSThread so my display pic can load in the background so im calling it by [NSThread detachNewThreadSelector:@selector(displayPic:aURL :aURL2) toTarget:self withObject:nil]; But as im passing through 2 Strings, how would i construct this statement? Thanks ...

iPhone - How to use ABTableViewCell ?

Hi, I'm working on a UITableView whose cells contain an UIImageView subclass which gets data from a URL and cache images to the iphone disk. Problem is, event with cached images the scrolling tends to be stuttering. So I searched a bit and found ABTableViewCell ( github.com/enormego/ABTableViewCell ) which is supposed to dramatically i...

NSURLConnection hangs on recieving not too big amount od data

I have some code here: (...) NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if( theConnection ) { webData = [[NSMutableData data] retain]; } and delegate methods: -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { ...

Linking of UITable Objects to URLS in xcode

In xcode, how do I link an object to a URL so that when a user taps the object, it automatically links him to the URL. I already have a table view with some objects on it ...

can't find managed object model?

I created a entity called photo inmy .xcdatamodel. but when I tried to add it into my context: NSManagedObjectContext *context = [self managedObjectContext]; Photo *p = [NSEntityDescription insertNewObjectForEntityForName:@"Photo" inManagedObjectContext:context]; it had run-time error: +entityForName: could not locate an NSManag...

Problem while converting NSData to int

Using foundation and cocoa frameworks on Mac, I am trying to convert an NSData object in humanly understandable number. Let say the NSData object is an image of NPIXEL. I know the binary data are coded in big endian and represent 32 bit integer (to be more precise 32 bit two complements integer). I write the piece of code bellow to conve...

How to know the bytes amount used by a pointer?

Hi, I have a pointer (uint8_t *myPointer), that I pass as paramether to a method, and then this method set the value to this pointer, but I want to know how much bytes are used (pointed ?) by the myPointer variable. Thanks in advance and excuse me by my english. ...

Adding Images in a TableView in Xcode

I tried to add images with the size of 32 by 32...it worked but it shows me only the first image for all the objects on the table view... In other words only image for all the other objects ...

Xcode iPad or iPhone Build Size Question

Had a question and if anyone has found similar issues. It seems my file size keeps growing. I have had to import existing files and then delete them from the project. It seems that it keeps those files somewhere. From being 40mb and importing a few .WAV files at 30mb each it goes up to 100mb. After I deleted them it seems it doesn't chan...

iPhone Linking to an iTunes page

I found a page (http://itunes.apple.com/linkmaker) to get the iTunes url for a specific page which I assume should direct the user out of my app and into the corresponding page in the app store. I have never done this or any other UIWebView stuff but after some searching I found some code that I thought would work that uses UIApplicatio...

Objective C difference between self.variable and variable assignments.

I fear I am being stupid. I've spent about three hours tracking down a memory leak that's been destroying my sanity and after commenting out half my app I have come to the following conclusion. Given the following in the right places. NSString *blah; @property (nonatomic, retain) NSString *blah; @synthesize blah; -(id)initWithBlah:...

converting grayscale to color on iphone

Hoping for some help here from someone with some solid objective c graphics experience. I am trying to build a heat map image and I am having some specific difficulties with color conversion. The generally recommended approach seems to be to create a grayscale image with ellipses representing the various points on the map. These ellips...

Newb ObjC Question re: BOOL property on a class

@interface... BOOL nameIsValid; @property (nonatomic) BOOL nameIsValid; @implementation... @sysnthesize nameIsValid; -(void)someMethod { nameIsValid = YES; } -(void)anotherMethod { if(nameIsValid){ ... } } Why does my if statement always evaluate to FALSE, even after the someMethod is called? ...

confused about NSString *str ...

I am kind of confused by the behavior of NSString *str.. I assigned it in several ways, sometimes it works, and sometimes it becomes null. NSString *str = @"/hi/hello"; // this one always works // this sometimes becomes null after the function ends NSString *str2 = [str lastPathComponent]; // as above NSString *str3 = [NSString string...

Expected specifier-qualifier-list before... Error in C++/Objective-C iPhone project

So I'm going through the first tutorial in O'Reilly's iPhone 3D Programming book. At this point in the tutorial, it pulls all the OpenGL ES stuff into a seperate c++ interface. I have followed the book to the letter, as far as I can tell, yet I can't seem to figure out this compiler error. I'm fairly new to C++ (mostly C# in the past), s...

How to create view from a nib file in xcode?

Hello I have the following code to create a view and put it in scrollview to allow paging the code works fine however what I couldn't do is loading views from a nib file in other words I want to use "initWithNibName" instead of "initWithFrame"? - (void)createPageWithColor:(UIColor *)color forPage:(int)page { UIView *new...

Cocoa - Pass parameter for setAction

Hello Everyone. I thought I'd try my hand at creating a simple cocoa app. It is a simple inbox notifier for reddit. I am bringing in a bunch of URLs and would like to make menu items for each URL with a link to the page. I 'd like to set the actions of each, dynamically. I need to pass the URL to the method, so it knows where to go. ...

Check if a C enum exists

How would I check that NSRegularExpressionSearch exists before using it? enum { NSCaseInsensitiveSearch = 1, NSLiteralSearch = 2, NSBackwardsSearch = 4, NSAnchoredSearch = 8, NSNumericSearch = 64, NSDiacriticInsensitiveSearch = 128, NSWidthInsensitiveSearch = 256, NSForcedOrderingSearch = 512, NSRegularExpressionSearch...

Not Using Dot Notation for Properties?

One of the books that I reference rejects dot-notation for properties in Objective-C 2.0. Is this a common mindset? Note: This is an empirical, programming-related question regarding the popularity of a syntactic tendency. Obviously, the most useless answers are personal -- "Well, I don't use it," -- and the more interesting ones come f...