objective-c

Spin screen with connection

Hello, I would like to know how to do the next: I have one app that make some connections to receive datas (this datas are show in the screen) I would like to know wich code i can use to wait each connection, I mean, the time between the connection start and this finish i would like to show in the screen one spin (Loading...). I have ...

Memory allocation and looping

If I alloc and init an object in a method that is called quite frequently, and if I don't release it immediately, does the object become a memory nightmare? Or will the alloc and init be ignored if the object is already in memory? This is somewhat difficult for me to explain, sorry! Thanks. ...

Easy way to get size of folder (ObjC/Cocoa) ?

Right now I'm using this code to get the size of a folder: NSArray *contents; NSEnumerator *enumerator; NSString *path; contents = [[NSFileManager defaultManager] subpathsAtPath:folderPath]; enumerator = [contents objectEnumerator]; while (path = [enumerator nextObject]) { NSDictionary *fattrib = [[NSFileM...

iPhone Objective C : Saving & Loading UIColor into & from NSUserDefaults

What's the easiest way to save UIColor into NSUserDefaults ? And how to re-create it from NSUserDefaults? Many thanks for reading ...

Generating a JSON payload for POST HTTP request in Objective-C

Does anyone have any sample code to create a JSON payload to be sent as a HTTP POST Request in Objective-C? An example of the json payload I am looking to generate looks like: {__metadata:{\"Uri\":\"/NewLoc/\", \"Type\":\"Location.NewLoc\"}, \"LocID\":\"100006\", \"latitude\": \"40.123456\", \"longitude\": \"-65.876543\", \"VisitDate\":...

Can I force all links in a WebView (or WebFrame) to be treated as absolute paths?

So I'm working with WebKit's - WebView and WebFrame. I use a custom NSURLProtocol to retrieve the HTML for each request from a database. The problem arises from the fact that the links in the HTML are all relative, when they really ought to be absolute. For example, the page foo/bar.html May have a link in it that points to foo/baz.ht...

UIViews associated with memory leaks

My GUI for an iPhone app uses numerous UIViews. The user "flips" through these views when they tap a button to go forward or backward. The views are stored offscreen and are added to an actual view only when the program needs to display it. During the flip process, the program tells the parent view (a uiscrollview) to remove any existin...

Error and warnings in Xcode when declaring Array of NSString* as a global extern

I am declaring an array of NSString* in a header file of a class. PolygonShape.h NSString* POLYGON_NAMES[] = {@"Invalid Polygon", @"Monogon", ...}; Now I am using this in PolyginShape.m as follows: - (NSString*) name { return (POLYGON_NAMES [self.numberOfSides]); } numberOfSides is an iVar which will indicate the index at which the...

RegexKitLite assertion failure occurring intermittently.

I'm using the wonderful RegexKitLite framework built upon the ICU library that ships with Mac OS X and iPhone OS. It has been smooth sailing so far, with the exception of this error that appears intermittently when searching for matches: Internal Error Invalid parameter not satisfying: (cacheSlot->setToHash == buffer->hash) && (cacheSlo...

How to open a new view when touching on a uiview?

i have a scrollview with uiview added as subview..now how do i open a new view when i touch on the view???? i want a new view to appear...before this i have buttons on my view...so button have the method "addtarget perform selector"...from that i am loading a new view here is an image of my view ...

How does a UIView know about an added subview's UIViewController?

in the case of say - (void)applicationDidFinishLaunching:(UIApplication *)application { ... [window addSubview:gameController.view]; ... } how does the view of gameController retain association to gameController? I've peaked through all of the Debugger variables and I see no association other than a boolean flag that it belongs to...

Objective C Code Explanation?

Hey guys, I had a question... I'm reading Cocoa Programming for Mac OSX and in Chapter 8 part 1, where he is writing the MyDocument.m file What does the line employees a; do? employees = [[NSMutableArray alloc] init]; is above, which means that employees is a mutable array, but I'm not sure what employees a; does. I'm just ta...

Is there an interface to create the glossy cut/copy popup

Is there a way to create one of the black glossy popups, similar to the one that appears to copy and paste text. I just want to give some information, so the behaviour I want is closer to the way the keyboard popup works when you type a letter but the appearance I want is the copy/paste dialogue. Are either of these open to the public, ...

Crypto library suitable for Objective-C

I'm looking for a crypto library to use with Objective-C code. There is a C++ library which is too big for my needs. It's 20 mb when compiled. I think a C library would be perfect to use with Objective-C. Here is my needs for this library: AES (Rijndael) CFB Mode SHA1 SHA256 HMAC-SHA1 HMAC-SHA256 PBKDF2 Your help will be greatly apprec...

UITableView Swipe to delete: how to customize button and action?

I want to perform different action, not delete objects but archive them. When user swiped on tableViewCell I need to show "Archive" instead of delete. change "Delete" button text and color to something else. How do I customize "Delete mode" appearance? ...

CLLocationManager ensure best accuracy for iphone

Does anyone have any suggestions on how to obtain the best horizontal accuracy on the location manager? I have set the desired accuracy to NearestTenMeters, but given that the accuracy can always change depending on coverage area, how can I write some code in the locationManager to stop updating only after I get the best horizontal accur...

Object Allocations going crazy.

I have CFArray and CFString allocations going all red while checking on the Instruments Object Alloc. Object seem to be alive but not being used, this because the used part of the histogram is 1/10th of the total histogram (which has turned red) in both cases. the app is a photo library application with 7 view controllers. Loading up ...

Phone Number Auto Spacing like AddressBook on iPhone

I want to be able to replicate what the AddressBook does in Contacts app and Phone app when entering a phone number in both the keypad on the Phone app and adding a contact. I know I could do it checking each time a character is entered into the UITextField but there are hundreds of number formats out there and it would take me forever...

How to tell with Objective-C if the iPhone is connected to a wifi network?

Hi, In the context of an Objective-C, iPhone application, I need to be able to tell whether the iPhone is connected to a wifi network, and if possible listen to changes in this state. Does anyone know how to do this? thanks, gabouy ...

UIWebView doesn't respond to link-taps when the link goes to a different domain

I load a page, saw on twitter, using a line like this: [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://twitter.com/OGOchoCinco"]]]; The page shows up fine. If the user now taps on a link that brings them somewhere else within twitter, she is brought to that page. However, if the link goes to http://...