objective-c

How can I count characters UITextView shows?

Hi all how can I learn total number of characters a UITextView shows in its specific contentSize after UILineBreakModeWordWrap applied. I will use different strings everytime as the text of UITextView. The strings are much longer than UITextView with its specified area can contain. The visible characters will be different for every di...

Creating Dashbord Widgets (using XCode?) based on iPhone app

Some time ago I developed an app for a client. It's basically a simple calculator. Because they like it so much they asked me if it would be possible to create dashboard widget with the same functionality based on the iPhone app. I have never before developed a widget, I only know that they are mostly html + css based, so this raises a ...

Core Data - Saving Relationships

Hi. If a Core Data relationship has an inverse relationship do you only need to set one of the relationships objects then the corresponding relationship is setup? In the past I have set both relationships but when looking at iPhone Core Data Recipes it seems they only set 1 of the relationships? Thanks James ...

How can I clear the contents of an NSMutableAttributedString?

I have an ivar which is alloc-inited in the init of an object: attString = [[NSMutableAttributedString alloc] init]; On a loop, I want to clear the contents of attString and re-use it. How do I do this? Thanks! ...

How to recognize diagonal swipes on the screen?

Hello, I'm using UISwipeGestureRecognizer successfully to capture and action when gestures on the screen are made with single or multiple touches in Up, down left or right directions using the standard tools. However what I really need to do now is have the device recognize diagonal swipes in the same way. Does anyone have any ideas wh...

Objective-c -> iphone design: delayed action

Hello! Sorry to bother, but I am in a bit of a pickle and I was wondering if anyone here could give me a hand. I am currently designing a game in which enemies appear on the left side of the screen (out of boundaries) and move to the right. I have used a number of codes (this is using Sparrow Framework) and pretty much the number of ...

Which method calls when we tap on to the start recording button in UIImagePickerViewController when capturing a video in Iphone sdk?

Hi Guys, I need a help from your side that I am capturing a video through UIImagePickerViewController and I need to know which method calls when we tap on to the start capturing button to set a timer to get the duration of the captured video. Guy's please help me to get rid of this. Thanks in advance, Madan Mohan. ...

UITextView delegates problem

Hi, I am trying to access the UITextView delegates and have a problem I have a UIViewController with the UITextViewDelegate protocol and a Nib containing the textView. If I set the delegate inside viewDidLoad like "textView.delegate = self" and I touch the textView, the app crashes without logging errors. If I start editing the textVi...

Looking for guidance on detecting overlap of UIImageViews

The scenario is that I have a UIViewController containing multiple "InteractiveUIImageViews" (inherited from UIImageView) each containing their own UIImage. In InteractiveUIImageView I have iplemented methods for touchesBegan, touchesMoved and touchesEnded to handle their movement and behaviour on screen. Certain objects of this type wil...

NSDictionary sort by keys as floats

Hi there basically I have an NSDictionary with keys and values. The keys are all numbers, but at the moment they are strings. I want to be able to compare them as numbers in order to sort them. eg: If I have a Dictionary like this: { "100" => (id)object, "20" => (id)object, "10" => (id)object, "1000" => (id)object, } ...

Unrecognized selector sent. Objective-C error

Hi, I am writing a google reader application and have been trying to create the settings table view with UISwitch. Below is the complete code sequence: @implementation Settings @synthesize rowImage; @synthesize ViewPushed; @synthesize alreadySignedIn; @synthesize syncStartupSwitch; @synthesize confirmMarkSwitch; @synthesize landscapeMo...

Use modal view as "normal" view

I want to use a modal view (UIViewController) as a "normal" view, which can be pushed on the navigation controller stack. Normally, a modal view is presented like this: LoginViewController *myView = [[MyViewController alloc] init]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:myView]...

Objective-c -> class method to main file query

Hi! Sorry to bug twice so quickly, but since people were so kind in their informative responces, I figured it couldnt hurt to ask another question. The same program i tried to make it rather swanky and have a main screen which allows you to click on a button which leads to a limited options screen. This lets you switch the music on ...

How do I format a date on the iPhone to have this specific output?

How do I format a date to produce the following output on the iPhone? 2010-09-24 13:00:00 -0700 ...

How do I create a Cocoa GUI to edit an array of NSDate objects?

In one app I am working on I need to let the user edit a list of dates. I have those NSDate objects in an array and bound that to a NSArrayController. I bound a NSTableColumn (the only column in a table view) to that array controller using the key path arrangedObjects.self. This works fine - I get all the dates displayed in the table jus...

Saving a PDF document to disk using Quartz.

Hello, I am trying to draw a pdf page onto a pdf context and then save it to disk. I cannot seem to figure out what is wrong. Can someone give me a few pointers. Thanks. - (void)testQuartz:(NSData *)pdfDocumentData { //Create the pdf document reference CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((CFDataRef...

objective-c/iphone: how to set that all methods of some object will run on a specific thread?

Hi guys, here is what i want: create an object that 'lives' in its own thread, all the methods should be executed in that thread. i.e: // i'm in the main thread MyClass *myObject = [ [MyClass alloc] init ]; // it creates its own thread [myObject method1]; // should execute the method1 in myObject's thread [myObject method2]...

iPhone ASIHTTP - Distinguishing between API calls?

I currently have a view controller that implements ASIHTTP for handling API calls. My view controller fires 2 separate calls. I need to be able to distinguish between the 2 calls in the -requestFinished(ASIHTTPRequest*)request method, so I can parse each one accordingly... Is there any of doing this? ...

iPad view appears sideways

I am working on an iPad app (which will not be submitted to the App Store) which supports only landscape mode. Most of the views in the application are pushed onto a UINavigationController with a hidden navigation bar. When I add the following code in the top view controller in the aforementioned UINavigationController, the new UINavig...

Editable, customizable UITextView in UIAlertView

EDIT: Not really a problem, I did a typo. It actually works just fine :) Original question: Hey. I'm trying to place a UITextView in or on top of an UIAlertView. I know that the UIAlertView automatically uses a UITextView if message of the alert is too long, but I want it to always be an UITextView, and I want it to be editable and ...