cocoa-touch

NSSThread identifier

Hi, is there anything like an identifier of a NSSThread? The following code: NSLog(@"thread: %@",(NSThread*)aThread); results in something like this: Thread: {name = (null), num = 6} Is there a way to get this thread number, maybe? Best, heinrich ...

How to Force UIButton to Refresh?

I have working snippet along the lines of: for (UIButton *b in buttonMapping) { [b setTitle:@"yo!" forState:UIControlStateNormal]; [NSThread sleepForTimeInterval:1.0]; } There's four buttons, all four buttons update. However, instead of updating one per second, four seconds go by & they all update. How can I force UIButton to up...

Compiler error when including C++ code in the iPhone project

Hi, I'm trying to include some C++ code into my iPhone project and I'm getting the following compiler error: "error:expected initializer before '<' token" at this code construct: template<typename T, P_UINT_32 BEG, bool OQ, bool OVR, bool DBG> P_UINT_32 EKType<T, BEG, OQ, OVR, DBG>::getSizeX() const { return n; } It looks...

Can a subclass of UIViewController directly control a UIImageView

Is it bad form to point the view property of my UIViewController subclass directly at a UIImageView? Or should my UIImageView be embedded in a UIView? I can't think of any problems with it, and it seems to work alright, but I thought I'd ask the hive-mind if there are any negative consequences to doing this. ...

Cocoahttpserver serving images from iPhone App Bundle

I am having trouble getting Cocoahttpserver from Duesty Designs (awesome open source library makers of CocoaAsyncSocket) to serve images from my app bundle. Using the example iPhone project I can serve up an html file from the Resources dir in my project, but images refernced like: <img src='foo.png' /> are not rendered. Does anyone ...

Double vs float on the iPhone

I have just heard that the iphone cannot do double natively thereby making them much slower that regular float. Is this true? Evidence? I am very interested in the issue because my program needs high precision calculations, and I will have to compromise on speed. ...

Upon exiting UISearchDisplayController's search table view, the screen flashes

I am using UISearchDisplayController to implement the search feature on a table view. My table view cell uses custom background image. When you first type a letter into the search textfield, the search results start appearing. However, when I click cancel at this point, the screen flashes white. This is not as noticeable if everythin...

Custom iPhone return key text

hi all, Is it possible to set custom return key type for UITextField? [txtField setReturnKeyType:UIReturnKeyDefault]; I want to have the word "SHARE" in place of the return key type. Thanks ...

iPhone - UINavigationController, reuse views?

The root question is "how many UIViewControllers can you push on the navigation stack?" Suppose I have an application that is basically a database for three entities where each can have a relationship with some other entity, and the relationship is shown on a UIViewController. Users can follow those relationships and each one brings up ...

Cocoa-Touch: When implementing drawRect, how do you redraw the transparent background?

I'm implementing a UIView's (UITableViewCell to be more exact) drawRect method. My view has a transparent background, so when something is changed in the view, the older drawn version still remains there. So if on the first drawRect draw an "A", then a "B" on the same point, I get both of them drawn on top of each other. How can I tell ...

Best way to implement Enums with Core Data

What is the best way to bind Core Data entities to enum values so that I am able to assign a type property to the entity? In other words, I have an entity called Item with an itemType property that I want to be bound to an enum, what is the best way of going about this. ...

How do I implement a draggable UIView subclass within a UIScrollView?

I have a rather tricky scrolling scenerio I need to get sorted. I have a parent UIScrollView with a single container view containing two child UIView subclasses. Call them viewA and viewB. The UIScrollView has been constrained to scroll/zoom horizontally. ViewA and ViewB are layed out as horizontal strips, one above the other. The bounds...

Getting first and last days of current week

How can I get first and last days of the current week? What I need is some way of filtering a set of objects with NSDate property to leave only ones, that appear on current week, and then filter them by days. Also I need some way to get localized day names. I've tried to play with NSCalendar, NSDate and NSDateComponents, but it seems th...

How to add an overlay view to a UIWindow that rotates

I have an app that rotates on some (but not all) screens, and I also want to add a UIView as an overlay that shows up on all screens, so I thought I'd add it to the window. The problem now is that when I rotate the device, the screens rotate, but the overlay view does not. I also tried using two UIViewControllers, one for the normal st...

Programmatically set UITableView datasource and delegate

I have a UIScrollView that contains multiple UITableViews horizontally - all of which are created programmatically depending on the user's action. Say I have 4 UITableViews, how do I set the datasource and delegate for each one programmatically? I understand there are tableViewX.dataSource and tableViewY.delegate methods; and I assume I...

How do I load a UIViewController from a NIB with placeholders?

I have a UIViewController that I want to load from a NIB that has a proxy (placeholder) object defined in it. The first time I load it, I go through this rigamarole: MyViewController *screen = [[MyViewController alloc] init]; NSDictionary *proxyDict = [NSDictionary dictionaryWithObject:myObject forKey:@"MyProxy"]; NSDictionary *option...

iPhone/Cocoa Touch - problem with multithreading (Stanford Presence 3 project)

I have been solving the Stanford free iPhone course project called Presence 3 (found on the stanford site: www.stanford.edu/class/cs193p/cgi-bin/downloads.php, which pulls data from twitter for users, which are stored in a plist. A UIActivityIndicator (spinner) is visible while the data is loading. Once the data has been loaded, a TableV...

Assigning actions to individual objects in UIPickerView

How can I do this without having a million if then statements? ...

Replacing Text in a UITextView

howdy, i'm trying to write a little concept app which reads the character stream as the user types in a UITextView, and when a certain word is entered it is replaced (sort of like auto-correction). i looked into using - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; b...

Is there a way to change color of just part of a string inside a UILabel?

Say I wanted to have the first six characters in black and the next six characters in blue, then the last 20 characters in black of a UILabel. Is this possible? Thanks! ...