objective-c

iPhone OS 3.0 playing movies wont work

Hello, The following code used to work but now it doesn't and I have not changed anything about it. if ([self respondsToSelector:@selector(presentMoviePlayerViewControllerAnimated:)]) { MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:selectedLink]]; ...

fbconnect iphone : i want to login every time. how to do that ?

Hi, i am using fbconnect in my iphone application to post on my wall. i want to login every time. how to do that ? currently if i login to facebook in my application once. it does not asks me for login next time... how to do that ? ...

problem in reading files in iphone application!

I am reading a file in iphone app. Its Works Fine. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSLog(@"%@",documentsDirectory); NSString *fileName = [NSString stringWithFormat:@"%@/test.txt",documentsDirectory]; ...

NSImage initWithContentsOfFile: display progress

Hello, I'm loading a very big file in an NSimage with this code : [[NSImage alloc] initWithContentsOfFile:aFile] This operation take a few time. I want to display the loading status on my UI. How can it's possible to read or calculate a progression ? Thanks. ...

particle animation in iphone sdk

hai i'm in need of particle animation in my uiview based 2D game. At present i'm using the array of images for particle animations this make my app size increase some time leads to memory leak also. Is there is any way to make particle animation using core animation if it give me some sample codes. Thanks in Advance. ...

In Objective-C, how do you initialise a constant from another constant?

NSString* const nits = @"nits"; NSString* const nuts = nits; // error: "initializer element is not constant" How is this done? ...

how to convert NSNumber to int in Objective-C

Before putting int value into dictionary i have set the int value as [NSNumber numberWithInt:2], now when i try to retrieve back the dictionary content , i want it back in int format.. hw to do this?? here's my code; NSMutabelDictionary *dict = [[NSMutableDictionary alloc]init]; int intValue = 300; [dict setObject:[NSNumber numberWith...

Swipe effect for uiimageviews

Hi all, I have a little question. I've made a little image gallery with a swipe effect to skip through the uiimageviews. That works fine but I want to improve it. The next or previous picture is shown not until the swipe has finished. But I want it to behave like the photo library for example or the home screen, that the imageview 'foll...

Using getrusage

Hello Everyone! As a continuation of this question I'm wondering if I can get some simple sample code as to how to make use of getrusage. I would like to use it to find the time CPU used by a process, ideally from the PID. I'm working in Cocoa, Objective_C and of course C. Any help would be awesome! Thanks ...

HI i am using core plot i am getting an error

HI i am using core plot i am getting an "'*** -[UIView setHostedLayer:]: unrecognized selector sent to instance 0xf283a0'" error in the line hostingView.hostedLayer = graph; ...

how to concatenate values from two Uitextfield into a single string in iphone

Hi. I want to take two value from user i.e name and location and then want to concatenate them into single string to produce output string IBOutlet UITextField *txtName; IBOutlet UITextField *txtLoc; want to concatenate tem to produce below string. Student Name is txtName and He is from txtLoc Bescically thats my complete code. ...

Is there a way to check if a NSLock was acquired?

Hi, I am working on multithreaded code. Data access is locked in several sections via "NSLock" objects. I want to ensure that some methods which are called within these sections check if their appropriate lock was aquired. Something like: assert([myLock isSet] == YES); I can't find something like "isSet" in NSLock. Any ideas how to ...

How to encode hebrew string (NSString) into a Unicode format in order to send as a URL in Objective-C

The title pretty much sums it up. I have a hebrew-containing String used in a NSUrl: NSString * urlS = @"http://irrelevanttoyourinterests/some.aspx?foo=bar&this=that&Text=תל אביב" I would like to convert in into: Text=%u05EA%u05DC%20%u05D0%u05d1%u05d9%u05d1 and then send it as a GET request. I have tried many encoding metho...

Setting MPMoviePlayer controlStyle to MPMovieControlStyleNone crashes app

I have an app which uses a manager to offer up the relevant custom view for a selected item when selected. The selection is done through one of 3 parent custom views TableView PageControl Gallery (essentially another TableView) One of the custom views displays a view with an embedded MPMovieControl on it. This works fine however fo...

Can I add buttons to sections of grouped tableView?

Hi, I have a grouped tableView with 5 sections and i want to add buttons per sections. For example i have add (+) button in all sections near the section title. Can i do that? Regards, ZaldzBugz ...

Xcode debugger: Break anywhere in my code following a given line of code

I have a given line of code, after which none of my own code lines should get executed (not in the same "event loop"). How do I configure the Xcode debugger to catch instances in which some of my own code indeed does get executed after this given line of code? If it's not possible to filter by the "event loop", can I filter it down to,...

NSBundle pathForResource:ofType: doesn't find all files in application bundle.

Hey. I have a Navigation-controller-based application with a number of Viewcontrollers in it which all have a property: NSString *infoFile; in them. In the viewDidLoad:-method i assign a path to this variable using self.infoFile = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"filename" ofType:@"html"]]; To accompany...

NSTask to call command top. Getting Error

Hello super-intelligent people! Thanks so much for checking out my post. Right now I'm running this: NSTask *task; task = [[NSTask alloc] init]; [task setLaunchPath: @"/usr/bin/top"]; NSArray *arguments; arguments = [NSArray arrayWithObjects: @"-stats", @"pid,cpu", nil]; [task setArguments: arguments]; NSPipe *pipe; pipe = [NSPipe ...

Objects passed by reference?

If I have an object 'Hotel' which has a few set properties and I pass it to another object which populates more of its properties and then releases it will the first class see these values? ...

NSTask spawns top process. How to extract data?

EDIT 1 This code is currently printing to the console. What I would like to do is get the data in a string (and stop the data going to the console) so I can parse it for specific information. I hope my question is clear. Please ask for clarification if needed :) EDIT 2 Another alternative could be to print it to a file and then I co...