objective-c

Problem positioning banner on top of my UITableView

I want to be able to display an ADBannerView right above my UITabBar (which displays a UITableView). Unfortunately my banner is not positioning correctly. It will appear right below the UITableView, and then as soon as I scroll, the banner will remain in the middle of my UITableView. I want the banner to appear right above the UITabBar,...

NSPredicate causes EXC_BAD_ACCESS - but only for Release configuration on device

My app works great in the simulator under any configuration and in debug configuration on my device but it is crashing on a fetch request I am doing as soon as I create a NSPredicate. Here is the offending code: - (void)searchBar:(UISearchBar *)theSearchBar textDidChange:(NSString *)searchText { //some fetch request code code ...

Custom Back Button to go to previous view for iPhone (non UINavigationController)

Hello, My current navigation scheme is as follows: Splash Screen where user selects specific topic The selection splash screen is hidden and displays the results (same Class as 1) When user selects result, it displays the full result (different class). Now, on view #3 is where I have a custom Back button, however, it's just sending ...

Benefit of indirectly allocating and initializing a declared @property

When it comes to allocating and initializing objects that are declared @properties of a class I've seen two main patterns in various bits of sample code, so given the following (made up) header code — @interface Class : Superclass { Object *anObject; } @property (nonatomic, retain) Object *anObject; The first, direct assig...

How can I animate my view resizing?

I am resizing my tables headerView. I want to animate it, but I am not sure how. -(void)layoutForBanner { // Depending on if the banner has been loaded, we adjust the content frame and banner location // to accomodate the ad being on or off screen. // This layout is for an ad at the bottom of the view. if(banner.bannerLo...

Passing argument 4 of 'objc_setProperty' from incompatible pointer type

I am getting this warning on the following line: @synthesize labels; Now, the rest of my declaration (in the .h file) is as follows: @interface Menus:SuperClass<Protocols> { ... UILabel **labels; } @property (nonatomic, retain) UILabel **labels; Does anyone know why this is happening? ...

Objective C - How do I inherit from another class?

- (id) init { [super init]; //initialitation of the class return self; } I know that when I am inheriting from another class I am suppose to call super.init Does this apply to "inheriting from NSObject" ? ...

Cannot get Cocoa notifications to work

Settting up the observer code: NSNotificationCenter *defaultCenter = [[NSWorkspace sharedWorkspace] notificationCenter]; [defaultCenter addObserver:self selector:@selector(updateLog:) name:@"Update Log" object:nil]; Sending the notification code: [[NSNotificationCenter defaultCenter] postNotificationName:@"Update Log" object:se...

Memory about lazy loading

I am reading tutorial book now. When I see an example, I get some confused. The following codes show a way for lazy loading. Does this motivations array be released after instance deallocated ? or will it occupy this memory block until application terminates. + (NSArray *)motivations { static NSArray *motivations = nil; if (!mot...

How can I run and test my own written program on my original iPhone after jailbreaking?

I have done jailbreaking. After jailbreaking I don't know how to install my helloworld program on my iPhone. Plz can anyone tell me the easiest way of installing / deploying my own program / app on my my iphone (hardware) step by step? Plz I m very much confused. plz .... ...

iphone: change the name of .app file ( app executable )

I have an application on app store. suppose the executable name is X.app. now i want to send the update and i changed the executable name to Y.app what happening is. when i update my new Y.app on device ( through Xcode ) that already has X.app installed. the splash screen comes and disappears and i am unable to start the application. W...

Loads an image from the given NSData of specified format(JPEG).

Previously I ask a question "How to convert data to JPEG Format?" and solution of this is: NSImage * strImage = [[NSImage alloc]initWithContentsOfFile:imagePath] ; NSData *imageData = [strImage TIFFRepresentation]; NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:imageData]; NSNumber *compressionFactor = [NSNumber numberW...

When to properly release an object

I am trying to better understand when to properly release an object in a fairly memory intensive program. My current doubt arises from the following bit of code: - (void)scrollViewDidScroll:(UIScrollView *)localScrollView { InteractionPointModel *model = [[InteractionPointModel alloc] init]; for (int x=0; x<totalInteractionPoi...

UITableViewCell accessoryType set, but accessoryView is nil. How do I set the accessoryView backgroundColor?

Here's how my cells are set up: - (UITableViewCell *)tableView:(UITableView *)tableViewIn cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"subcategory"; UITableViewCell *cell = [tableViewIn dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewC...

Multiple window application

I am looking for a cocoa example that illustrates how to create a multi-window app. Two windows, two nibs. Clicking a button in one window shows another window. How can I do this? ...

Is it possible to know what text is displaying nearby the mouse?

I am just planning to implement some features like "Look up in Dictionary" when the mouse hovers over some text/words on the screen on the Mac OS X platform. How can I get the displaying text/words nearby the mouse on the screen, even if they're not in my own application. What I can do is: Using WorkSpace to know what applications ar...

dynamically creating variable names in objective-c

hey all, i'm in a bit of a situation here... i am passing a string to a function and in that function i need to create an array whose name is the value of the string. Say, for example: -(void) function : (NSString *) arrayName; //let arrayName = @"foo"; In this function I need to create an array named "foo" i.e the value of the passed pa...

How to store a NSUInteger using NSCoding?

How do I store a NSUInteger using the NSCoding protocol, given that there is no method on NSCoder like -encodeUnsignedInteger:(NSUInteger)anInt forKey:(NSString *)aKey like there is for NSInteger? The following works, but is this the best way to do this? This does needlessly create objects. @interface MYObject : NSObject <NSCoding> { ...

Do I need to release the NSString * temp = @"aaa" ?

For example, I need to append a word to an existing string. NSString * temp = @"some prefix"; someString = [temp stringByAppendString: someString]; Should I release the object temp? ...

How can I give "+123" to an NSNumberFormatter and not get a "NaN' back ?

I have set up a nice NSNumberFormatter which does all the things I want, except allowing a number to be preceded by a unary "+". It's not a common usage normally, but I'm entering latitudes and "+12.34" is sometimes used to indicate a northern latitude in the same way "-43.21" indicates southern. Likewise for longitudes and East/West. ...