objective-c

calculate calendar week

Hi, how can I calculate the calendar week? A year has 52/53 weeks and there are two rules: -USA -DIN 1355 / ISO 8601 I'd like to work with DIN 1355 / ISO 8601. How can I manage that? Edit: NSDate *today = [NSDate date]; NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; [dateFormat setDateFormat:@"ww"]; NSString *weeknum...

Close other multitasking apps with our application with code - iPhone

I want to close other application running background with my app how can i do it? ...

NSMutableDictionary Memory management.

Hi, please go through the following code and please explain why is it crashes in last line? NSMutableDictionary *dic1 = [[NSMutableDictionary alloc] initWithCapacity:10]; NSString *val = [[NSString alloc] initWithFormat:@"Deepak"]; NSString *key = [[NSString alloc] initWithFormat:@"First Name"]; int a = [val retainCount]; a = [key ...

sprintf fails spontaneously depending on what printf and NSLog calls there are.

Hello I have a bizarre problem with sprintf. Here's my code: void draw_number(int number,int height,int xpos,int ypos){ char string_buffer[5]; //5000 is the maximum score, hence 4 characters plus null character equals 5 printf("Number - %i\n",number); sprintf(string_buffer,"%i",number); //Get string printf("String - %s\n...

How to create weak reference in Objective-C?

Hi, i have a situation like this: NSMutableArray * A = [[NSMutableArray alloc]initwithObjects:@"one",nil]; NSMutableArray * B = [[NSMutableArray alloc]initwithObjects:@"two",nil]; [A addObject:B]; [B addObject:A]; now here is a retain cycle, How can i break this retain cycle? (using weak reference)....in above example. Thanks ...

Refresh FlowCover

Hi I have no ieda how to refresh the images in a flowcover http://www.chaosinmotion.com/flowcover.m I have tried [view reloadData]; but haven't been successful. Can anyone tell me what I should do please? ...

BING Map in iPhone Application

How to integrate BING Map into iPhone Application? I am doing using VirtualEarthKit framework (http://consonancesw.com/blog/?p=64). My code is as below : I am getting error while getting token. { VECommonService *commonService = [[VECommonService alloc] init]; NSString *token; printf("2\n"); NSError *error=[commonService getToken:&t...

problem with listener pattern using fast enumeration

Hey, right now I have implemented my own listener pattern. I will send an update to the listeners using fast enumeration. the code will look like this - (void) updateListeners { for (id<AProtocol>listener in _listeners) { [listener update]; } and in listener, i implement method for AProtocol, which is update. suppose there are n ob...

iPhone SDK loading screen

I have a view in my app where I use a very large photo that is Hi-Res and takes a bit of time to load. How do I put a loading screen while this is happening? The kind of loading screen with the spinning loading wheel so that the app does not look like it has frozen? Thanks in advance for any help! Edit: Note that I am simply loading the...

Changing tintColor of UISearchBar inside ABPeoplePickerNavigationController

Hi everyone, I am tyring to customize the colors a bit in a ABPeoplePickerNavigationController below is my complete code: ABPeoplePickerNavigationController *objPeoplePicker = [[ABPeoplePickerNavigationController alloc] init]; [objPeoplePicker setPeoplePickerDelegate:self]; objPeoplePicker.topViewController.navigationController.navigat...

My allocated memory is beeing written to

Im writing a project in Objective-C but I'm relying quite much on plain old C since there's OpenGL involved. I have a data blob that I read to memory from a file in the following way: NSString *path = [[NSBundle mainBundle] pathForResource:@"iPadTest" ofType:@""]; NSFileHandle *file = [NSFileHandle fileHandleForReadingAtPath:path]; dat...

Removing subview for activity indicator

I have built a new view with an activity indicator attached, loading this nib, seems to be working fine on another view: - (void)viewDidLoad { [super viewDidLoad]; ProgressViewController *progresssView = [[ProgressViewController alloc] initWithNibName:@"ProgressViewController" bundle:nil]; [self.view addSubview:progresssVie...

Doubt abt MFMessageComposeViewController and the iPhone simulator

Hi all, I am new to iPhone developement. Here is my question. I would like to do a 'device texting capability' check on my iPhone simulator before I deploy it to my phone. This is the code I wrote in the .m file. This is the function which is called when my SMS button is triggered. Class messageClass = (NSClassFromString(@"MFMessa...

Having trouble with this NSURL method.

Hi, Can anybody tell me excatly how I should execute this method on an NSURL object? URLByResolvingSymlinksInPath Compiler says that the method can't be found when I execute it. Thanks a lot. This is where I am trying to implement the code: - (void)data { NSURL *url = [[NSURL alloc] initWithString: [[user data] objectAtIndex: 5...

Where does the image go when i take a screen shot?

On click event of a button [mybutton addTarget:self action:@selector(captureView) forControlEvents:UIControlEventTouchUpInside]; - (void)captureView { UIGraphicsBeginImageContext(CGSizeMake(320,480)); CGContextRef context = UIGraphicsGetCurrentContext(); [self.view.layer renderInContext:context]; UIImage *screenS...

Can't push view onto stack

I have a view controller: @interface DetailViewController : UIViewController It displays a map and pins are dropped onto this map. When the user tap's the accessory button one of the annotation views I want another view to be pushed in front of the user. For some or other reason the navigation controller is always null when I run ...

How do I wait until an NSOperationQueue has finished in a Unit Test?

The Problem I have an NSOperationQueue called logEntryGeneratorQueue I want to wait until all operations on the queue have completed If I use: [logEntryGeneratorQueue waitUntilAllOperationsAreFinished]; it works fine if the thread adding to the queue is in the background itself. However, if I'm running this code via a unit test,...

Does Apple ship debugging symbols for the iPhone Simulator APIs?

I am a bit of a iPhone/Mac OS newb. When I look at a backtrace in the debugger and UIKit or other Apple Libraries are on the call stack I can't see their function arguments because of missing debug symbols. Does Apple Ship debugging symbols for the iPhone Simulator libraries like UIKit? Thanks. ...

Objective C: Accessing next cell of a UITableView

How can I access (to change the imageView.image) the next cell of my UITableView given that I already have: UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; ...

How can I display a introduction modal view when the app start up?

I have a tab bar application and I want to display those views that most part of apps have, with the name of the company or the name of the app. I've created the follow viewController Introduction *introducao = [[Introduction alloc] initWithNibName:@"Introduction" bundle:nil]; I don't know where exactly should I insert the code to s...