objective-c

How can I get an encoded string from NSData in Cocoa?

In .NET, I can use Encoding.UTF8.GetString(string str) or any other flavor of Encoding, to get the string representation of a byte array. Does Cocoa contain similar functionality out-of-the-box, or do I need to write some stuff to make the conversions myself? ...

Possible scenarios of using alloc/retain/release on iPhone?

Hi, I have been using ojective c for almost a week, and I am mainly a c++ coder. After I read Apple's memory management guide, I try to bring my memory usage style in c++ into objective c... I tried to conclude these scenarios, I think I won't make memory mistake if I follow these instructions. Please kindly let me know if I am wrong :...

Problem presenting a UIActionSheet from a double tap in UITableViewCell

I am presenting a UIActionSheet when a user double taps my cell: Tap Recognition in Cell Init: UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)]; [doubleTap setNumb...

what is garbage collected environment in iPhone?

Hi, everyone, I want to ask some question about the iPhone or objective C. What is 'garbage collected environment'? Thank you very much. ...

[IPhone] How to animate text color of an UILabel?

Dear All, Could you please tell me how animate text color of an UILabel? for example: change color from WHITE to RED then come back to WHITE with fade in effect and repeat in about 3 times. I need this animation due to my app get real time data from internet, and when value is changed, I need to animate this text value to tell user th...

where to store constants in an iphone app?

Where do you store app configurations constants (not user preferences)? store in Info.plist? store in SomeOther.plist? store as static (extern?) constant in a .h? store as #define somewhere? (where?) Thanks. ...

Retain count and dealloc in iPhone

Hi, everyone, I want to ask about the iPhone application and objective C question. In the implementation program, there are function called 'dealloc', does this function only be called one time by the application? For example, if I alloc a object and retain it 2 times, the retains count is 2 and I never use 'release' in the program,...

otherButtonTitles in UIAlertView

I was just curious about how can i attach some different task to the otherButtonTitle of UIAlertView. The cancel button automatically take you out of the application but if i want to attach a different task with the otherButtonTitle ,what should i do? Thanks, ...

iphone: Large html document into string

I am building an HTML file which will later be emailed through my app. Currently I am creating the html by appending the strings together. This is a painful process. Is there another way that I can just put a large block of html into an NSString? Currently the line breaks in the string are screwing it up. ...

Is there a way to detect when a standard iPhone View Controller push/pop animation has completed?

For custom animations in my app, I can use the setAnimationDidStopSelector: method to respond to the event that an animation has finished. Is there a similar kind of mechanism for detecting that the animation has finished for a standard View Controller animation transition for pushes and pops? (i.e. [self.navigationController pushView...

Scroll View in Grid TabelView

Hi, I m completely new for iPhone development and that is the reason I have a query regarding how to implement scroll view in table view i m using following code #import <UIKit/UIKit.h> @class ScrollViewViewController; @interface ScrollViewAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; ScrollViewViewContro...

How to wake from sleep programmatically?

I want to wake system from sleep programmatically, is there any way to do this? I have read following link: http://developer.apple.com/mac/library/qa/qa2004/qa1340.html this only talk about getting notification , but not sure is there any way to wake system from sleep? I appreciate some thread to the information... Update: As per th...

Passing variable to another view (using Utility template)

Okay, so I'm obviously a newbie, but I need some help passing a variable to another view. I'm using the Utility Template in Xcode. I think I have everything linking properly (including the proper header files and whatnot). Just don't know the proper syntax. Here's what I'm trying: NSDate *time =[flipsideViewController.datePicker date];...

Sharing Non-Persistent Objects Between Contexts in Core Data?

I was wondering if there is a way to share an NSManagedObject between two or more NSManagedObjectContext objects running in the same thread. I have the following problem: I have one main context shared through all my code in the application and several different contexts that are created for each remote fetch request that I issue. (I c...

QPen equivalent class in objective c.

I need to draw some figure on context(Canvas). So , need a class which is equivalent to QPen. If anyone know plz help me out. ...

switching between views in iphone programming

i want to go to another view from one view on a button click please help me........ thank you ...

problem with logging in twitter through my iphone application

Hi all, i am creating a music application in which i am integrating twitter in my application When a user clicks on particular song and then he click on the twitter tab the login page of twitter should be displayed. after entering the username and password he should be directed to the page where he can enter his comment and then post i...

How to resize cover images in OpenFlow

I'm trying to embed OpenFlow in my iPhone app, but I can't figure out how I can resize it in a landscape view with a navigation bar and a toolbar. The covers are too big and the effect is really ugly. Can anyone help me? ...

Can't add a corner radius and a shadow

Hiya, I'm trying to draw a shadow and a corner radius on an image. I can add them separately, but I've got no way to add both effects at the same time. I'm adding a shadow with: [layer setShadowOffset:CGSizeMake(0, 3)]; [layer setShadowOpacity:0.4]; [layer setShadowRadius:3.0f]; [layer setShouldRasterize:YES]; Here, layer is a CALaye...

NSStream hangs on close

I have an NSInputStream and an NSOutputStream in an iphone app that are connected to a server. I am able to read and write data to the sockets without issue. The problem is that I have a disconnect button, and when I try to call close on either of the streams it hangs the app. I'm guessing that I am trying to call close at the wrong time...