objective-c

Leak when adding subview

So Instruments tells me I have three memory leaks originating in this method (specifically, it points out the line: [self.view addSubview:menuBar.view]; I can't see a leak and am racking my brains. I'm keeping a reference to the menuBar object and am releasing it. Anyone smarter than me that can explain? Is it a coincidence that I have ...

How to show disclosure indicator while cells are in edit mode?

I have a UITableView that can be edited. I am displaying cells as such: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) {...

How to implement admob on view controller?

Hi Guys, In my app, I want to implement admob and now only I have started to learn about it. So any one please guide me and is there any nice tutorial or sample? ...

iPhone Sdk: UITableViewCells copy themselves randomly

hi, i have been trying to figure this out but i just can't.... for some reason, everytime my UITableView reaches a certain length due to the number of rows and sections, cells seem to randomly copy themselves into different cells at the end of the table without me wanting or programming it... Anyone else have this issue or knows how it's...

App suddenly crashes when run on Device

My app runs great in the simulator, and has been working great on device as well. Today I am trying to install on device and the app crashes. It still works in the simulator. I am getting no debug errors: [Session started at 2010-07-19 10:35:01 -0700.] GNU gdb 6.3.50-20050815 (Apple version gdb-1470) (Thu May 27 05:54:06 UTC 2010) Copyr...

Creating Objects & Setting iVars in a Loop?

NSArray *planetArray = [NSArray arrayWithObjects:@"Earth", @"Jupiter", @"Saturn", @"Neptune", @"Pluto", nil]; NSMutableArray *objectArray =...

Memory leaks in delegate

Hi, My controller get data from function in delegat: - (NSArray *)getChapters { NSMutableArray *list = [[NSMutableArray alloc] init]; //memory leak if (chapter_statement == nil) { const char *sql = "SELECT DISTINCT 'Глава '||chapter FROM verses WHERE book=? ORDER by chapter"; if (sqlite3_prepare_v2(database, sql, -1,...

Vertical align with CoreText?

How do I change the vertical alignment of the text in a CTFramesetter frame? I want my text to be in the middle instead of being at the top. I am using CoreText framework. There is a setting of the paragraph to change horizontal aligment but not vertical. ...

Foundation/NSObject.h: No such file or directory what the reason on windows

When I compiled an Objective-C code on Windows, I got this error. $ gcc -o abc main.m In file included from MyClass.m:2, from main.m:2: myclass.h:1:32: Foundation/NSObject.h: No such file or directory In file included from MyClass.m:2, from main.m:2: myclass.h:4: error: syntax error before '(' token ...

NSNumber Warning when using setter but code seems to work OK - Passing argument 1 makes integer from pointer without a cast

I have an object Foo that has an NSNumber property which is declared like this: @property (retain) NSNumber *siteID; and @synthesized. When I I do something like this: Foo *myFoo = [[Foo alloc] init]; NSNumber *newNumber = [[NSNumber alloc] initWithInt:42]; myFoo.siteID = newNumber; [newNumber release]; The assignment on line 3 th...

after [self.delegate flipsideViewControllerDidFinish:self]; do something

Once the mainviewcontroller is loaded via [self.delegate flipsideViewControllerDidFinish:self]; I want the app to do a message box what void do i need to use as - (void)viewDidLoad { does not work thanks Mason ...

Store Admin Password in OSX Keychain For Automating Certain Processes?

I have a whole series of commands that I need to run on login, many of which require root privileges. So, to save a few steps I put them all into one apple script so I wouldn't have to open the terminal. But still, I'd like to be able to do this without entering my password at all (I like to boot my machine early AM while I'm still sle...

UITableView scrollToRowAtIndexPath: help

I have a regular UITableView without any sections set up. I'm trying to automatically scroll to a row at a given index path like so... [table scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[self getIndexToShow] inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO]; But when ran I get this error... 2010-07-19 18...

completing example of CMMotionManager example listing 4-9 and 4-10

http://developer.apple.com/iphone/library/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/MotionEvents/MotionEvents.html listing 4-9 and 4-10 i tried to run the code but with no success, i run into a problem with gyroHandler. can someone post an example of a completed code, without much changing the sample listings? meaning...

objective-c round number to nearest 50

How can I round a number to the nearest X value (for example 50) i.e 47 would be 50 24 would be 0 74 would be 50 99 would be 100 etc... I really have no idea where to start looking into how to do this... P.S. Im using cocoa-touch for the iPhone Thanks a lot Mark ...

popToRootViewControllerAnimated Question

Hi all, I have a UINavigationController in my iPhone app controlling views in a drill-down fashion. I have 4 viewcontrollers that I pass through before I have a "Start over" button, where I would like the action to send the user back to the beginning of the view hierarchy. [self.navigationController popToRootViewControllerAnimated:YES...

Is there a simple way to detect if a UISearchBar is exiting "Search Mode"?

Hi, I'm trying to set up a UISearchBarDelegate My first attempt was to clear the search results when searchBarShouldEndEditing: was called, but I discovered that this gets called when scrolling through the search results, which is not a time to be getting rid of the array of them. My next attempt is searchBarCancelButtonClicked: - but ...

Views have wrong position and size in landscape mode.

Hello, I'm developing "landscape mode-only" app for an iPad. Problem is that my views have wrong positions on the screen, and I can't find the reason... I've set necessary properties in the Info.plist: <key>UIInterfaceOrientation</key> <string>UIInterfaceOrientationLandscapeRight</string> <key>UISupportedInterfaceOrientat...

How to set UITableViewCell background image with different heights?

I have a UITableView and would like to apply a background image to all cells. My height for each cell is variable. How should I go about creating the background image? cell.contentView.backgroundColor = [UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background.png"]]; ...

iPhone Objective-C: Best way to handle logout user A -> login user B ?

I have an application that uses OAuth whose logic is something like this: If there is a request token for the user that is valid stored, loads a UITabBarController with four views. Else, brings the user to the login screen. I realized today that if I am logged into my app, log out, and switch to another user, the data from the first us...