objective-c

iOS SDK UIViewContentModeScaleAspectFit vs. UIViewContentModeScaleAspectFill

I have an image that I would like to display in a UITableViewCell using the UITableViewCellStyleSubtitle style that provides a UIImageView, and two lines of text, plus an optional accessory view. However, when I set the content mode of the UIImageView to either of UIViewContentModeScaleAspectFit or UIViewContentModeScaleAspectFill, it ...

OS4 and iphone app speed issue

Hi everyone, I updated my 3G iphone to 0S4 and the game I wrote for it is now very slow. I.e it starts off well, but then the game slows down after a while and it becomes uplayable. I ran instruments but instruments cannot run and becomes very slow so I tried running it against the simulator and noticed the same thing. Also my ram neve...

Quartz 2d / Core Graphics: What is the right way to draw some text?

I've been at this for awhile, it seems that there's many ways to go about this in quartz 2d: 1) Draw text using core graphics methods... CGContextSelectFont CGContextSetRGBFillColor CGContextShowTextAtPoint and on and on, which is horribly low level. 2) using NSString drawAtPoint (so far the method I like) NSString* text = @"Hello"...

Internationalization and Validation

My app has a registration page for new users and I'm trying to carefully support as many languages and locales as possible. One of the rules for their desired username is that it must be alphanumeric, but when I type Japanese characters into that field it never passes validation. Do you know of any good resources on best-practices for ...

Iterating Through an NSArray

Can someone help me fix my code here. I am trying to do something simple iterate through the whole array that has NSString's in it convert them to NSIntegers and assign them to a NSInteger variable. for (NSInteger *itemF in myNSArray) { //WHERE "slotA" is an NSInteger and "itemF" is stored as an NSString and I wanna conver to NSI...

NSTextView Insert Line Break

Hi Folks! I have an NSTextView that I need to insert a line break in. The code looks like this: NSString *myString = @"test" [myTextView insertText:myString]; /**** INSERT LINE BREAK HERE ****/ [[myTextView textStorage] insertAttributedString:MY_ATTRIBUTED_STRING atIndex:myString.length]; Anybody have any idea how to do this? ...

Loading all the values of an attribute of core data to an array

I have an attribute "term" which is a NSString in my core data "Event". When the table view is loaded I want all the values of "name" to be loaded to an array. I used the code - (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath { Event *event = nil; event = [fetchedResultsController objectA...

Localizing Dates From Remote Server

I'm storing all dates on my server as UTC. I fetch this data to my app via JSON and am successfully parsing these dates. How should I localize the dates in Objective C? ...

iPhone private API of canAuthenticateAgainstProtectionSpace and didReceiveAuthenticationChallenge

Hi, everyone. I want to ask a questions about the canAuthenticateAgainstProtectionSpace and ddidReceiveAuthenticationChallenge. Are they private API iPhone application? If yes, how can I modify it? And after I modify the private API of iPhone, will the iPhone reject my application? If no, where should I put the modified code? I used ...

Initializing NSArray And Adding An NSInteger To It

I am having problems initalizing an NSArray and adding integers to it here is my code below which I commented in what I am trying to accomplish can someone help me fix it? my app crashes when adding an object, but I dont know if I am clearing the array correctly either. //CREATE AND INITIALIZE AN ARRAY NSArray *ticket; ...

what is the different between class method and delegate method in iPhone

Hi all, I have a questions about the iPhone application. I am the green of the iPhone application. When I read the document(PDF) download from the apple developer website (online version). I found that the document always mentions different methods of the library. There are 1) Class method 2) Instance method 3) Delegate method I un...

Help with Triangle collision detection in Obj-C

I haven't taken any advanced math courses or anything (I'm still in high school) and I just don't really understand all the triangle collision systems online. I have two triangular objects in a 2D space. How should I write Obj-C code so that a collision/intersection between the two can be detected? I'm stumped. ...

NSString's character reference.

I want to convert the NSString that have character reference (& ' etc..). ex. before: "I'm happy." after: "I'm happy." ...

iPhone / iPad user profile tracking

My iphone app downloads user specific data from our web server. How can I identify a unique user/device? cookie? ip address? or do I need them to register first? What are some issues I need to be aware of? best practices? ...

Passing Object Between View Controllers in Objective C

I have a very simple iPhone view based application I need help on. It's a view based application with a nav. bar in the footer that switches between 4 view controllers. What I need to do is pass a UILabel value from view 2 to view 4. The UILabel field is a value calculated in view 2, but I want it to appear in view 4 (if 5+5=10, I wan...

iPhone/iPad Custom menu on selection in UIWebView

I want to modify the default options to just Copy and Highlight. I looked through the documentation for UIMenuController but still couldn't figure out. I'm new and learning. Please point me to the right path. ...

Declaring delegate

Just realized that the delegates I am declaring are not declared with pointer type. so instead of this id <AddViewControllerDelegate> *delegate; I have this id <AddViewControllerDelegate> delegate; Why the last way is correct? Since self is pointer(I guess) then why delegate is not? ...

Objetive C invalid objects

Hi All, Can any one guide me with invalid objects created in objective C. I am working on iPhone SDK. I see invalid objects created in the application which crashes the application. Here is a screen shot of how it looks like where as in the log I get Program received signal: “EXC_BAD_ACCESS”. I require help with the follows. Ho...

CLLocation Manager Delegate changes in iPhone OS 4.0.

Hi, In iPhone OS 4.0 the CLLOcationManager Delegate is not getting called . Code: -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions { [self newLocationUpdate]; } -(void)newLocationUpdate { locationManager = [[CLLocationMan...

Is there a Cocoa/Obj-C equivalent framework to log4net?

Looking for a good logging framework for a Cocoa App. I've used log4net before for a C# app. Is there a similar thing for Cocoa? Thanks! ...