objective-c

Swapping between UIViews in one UIViewController

I'm still finding my way around the iPhone SDK, I've followed some good tutorials but I am trying to find some simple solutions for the time being. Right now I want to knock up a simple app that will share the same UIViewController. I have created multiple views in Interface Builder and given them unique names in the Inspector (Identit...

Will this format a phone number in Objective-C?

NSString *origString = @"1 888 2313 1231"; // or anything like that, 423-2342 should work too [[[origString componentsSeparatedByCharactersInSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]] componentsJoinedByString:@""] length] == 7 ? ([NSString stringWithFormat:@"%@ (%@) %@-%@", [[[origString componentsSeparatedByC...

UIActionSheet orientation

Hi guys! Is there any way to set the orientation of the UIActionSheet programatically? My iPhone orientation is Portrait, but the UIActionSheet need to be Landscape. Can this be done? Edit: So my problem is that I don't want to rotate the rootviewcontroller to landscape mode, only the UIActionSheet. So is this possible somehow? ...

Problem with UItableView cell image

I have problem to display re-sized image in a tableview cell. sometimes the resized(means smaller,after selecting from libray)image displayed with a vertical line at right side.when displayed from global database the same image displayed correctly but from local (means stored i phone as userdefaultclass ) it contains a thin vertical bar...

Xcode Code Sign error: The identity 'iPhone Developer' doesn't match

i tried to compile by iphone app in xcode and i got this Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain how do i get rid of it? i dont plan on selling anything on the app store just yet cause i just started with objective-c. do i have to register with the d...

fbconnect logout is not working perfectly

i have integrated Fbconnect in LoginViewController.I want to logout the session from another view controller .. How i can do this ? I tried this .. LoginViewController *obj1 = [[LoginViewController alloc] init]; [obj1._session logout]; [obj1._session.delegates removeObject: self]; It removing the session..But wen i go to Login...

if-query: if (Nslog isEqualtoString @"...") - How can I make this??

Hello, I want my app to do something when the last NSLog has a certain string. I thought I could realize this with an if-query and isEqualtoString, but how can I make this? Sorry for my bad English ;) ...

How to dynamically instantiate a class in Objective-C

Can I know how to dynamically instantiate a class in Objective-C? ...

Finding curCapacity and maxCapacity Value, iPhone

Hello all, A method which can be used for finding the battery percentage of your device is found here: http://blog.coriolis.ch/2009/02/14/reading-the-battery-level-programmatically/comment-page-1/#comment-6085 I have tried it and it works great. If you have a closer look at the code there are two values curCapacity and maxCapacity. I ...

Replace array display method?

I am curious how I might override the description method that is used when you do the following (see below) for an object. I basically want to better format the output, but am unsure about how I might go about setting this up. NSLog(@"ARRAY: %@", myArray); many thanks EDIT_001 Although subclassing NSArray would have worked I instead...

NSPopUpButton in a TrackingArea -> mouse exited when selecting an item from the menu

I have an NSPopUpButton inside a trackingArea. Now when I open the PopUp and select an item, the mouseExited: method gets called. Even if my mouse is still inside the trackingArea. I assume that that is because the NSMenu is a view itself and when I click the mouse it is not in the view with the tracking rect anymore. How can i workarou...

how to get desired Accuracy from core location in simulator?

i want to check the desired accuracy in simulator but i never get it within didupdatetolocation method.I know that in simulator delegate method is called only once.Does someone knows how to get desired accuracy in simulator.Here is my code to get desired accuracy. // Delegate method from the CLLocationManagerDelegate protocol. - (void)l...

how to reinit the viewcontroller every time.

I am changing the background color from single view controller to all other view controller. but it is working only when i start with that single controller . if i started with any other controller then i am not getting background change for that controller. I though that because if i start with some other controller , its init method...

iphone code - using NSArray

hi, how can i implement an NSArray in this method (instead of just defining each one of the objects). code: - (void) fadeOutShuffleAnimation { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration: 0.8]; [UIView setAnimationDelegate:self]; juw1.alpha = 0.0; juw2.alpha = 0.0; juw3.alpha = 0.0; ...

UITableView gaps when using dynamic row height

I have a UITableView of height 400px which I want to fill with either 10 or 11 custom UITableViewCells depending on the data to be displayed. The problem is that depending on how I set the height of each row using my current method, there are gaps between cells or below the bottom cell. I assume this is due to rounding. This code puts s...

Return Capacity Values, Not Percent (iPhone)

Using this method here how would I return the curCapacity and maxCapacity mAh values rather than a percent? http://blog.coriolis.ch/2009/02/14/reading-the-battery-level-programmatically/comment-page-1/#comment-6089 No matter what I try my curCapacity and maxCapacity values match my battery percentage! Edit // My 1st attempt #include ...

iphone code - objectAtIndex question

hello, what doe's the upper objectAtIndex used for?, it seems to work with any number, why? AppRecord *appRecord = [self.entries objectAtIndex:1]; [[[[[self tabBarController] tabBar] items] objectAtIndex:1] setBadgeValue:appRecord.badgePrize]; ...

Using Exception Handling versus NSError in Cocoa Apps

Hey all. I've been reading up on Apple's suggestions for when/where/how to use NSError versus @try/@catch/@finally. Essentially, my impression is that Apple thinks it best to avoid the use of exception handling language constructs except as a mechanism for halting program execution in unexpected error situations (maybe someone could give...

iphone code - use a custom table instead of default one

hi, i'm using a default style table, i want to add more rows to the table, how can i customize it? code: UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdent...

UITableView reloading data / refreshing (possible duplication issue)

I have a UITableView in an iPhone application which I am refreshing (by calling [self.tableView reloadData] in the action method for a UISegmentedControl dynamically embedded in one of the UITableView cells. The table view is refreshed to update a text value for one of the cells. However, the following code seems to produce an unwanted ...