cocoa-touch

Odd behavior while sending HTML email with MessageUI.framework

I'm using the MFMessagePickerController, and calling setMessageBody:isHTML. Setting isHTML to YES, of course. However, when the string I'm sending is something like this: <html>look at my image! <img src="http://foo.com/img.jpg"/&gt;&lt;/html&gt; what the recipient gets is just "look at my image!" in plain text. viewing the raw source...

Are real products needed for In App purchase testing?

I'd like to test In App purchasing with my test user. However, it seems as though I need to create a real product and associate that to a real app. This product is then searchable in iTunes. If I'm only testing, I don't want the product searchable in iTunes. Can anyone shed a little light on that aspect of the testing experience for ...

KVO on an NSCountedSet?

I'd like to monitor an NSCountedSet to see if its contents changes. Setting up KVO seems to compile but it's not being triggered. First question: can you observe a set? If so then is there something wrong with this message? [subViewA addObserver:subViewB forKeyPath:@"countedSet" options:0 context:NULL]; I'm really just trying to m...

UITabBar / UIToolBar overlap problem (iphone sdk)

I have a custom button in another view directly above my UITabBar. It seems like there's a hidden "hit area" above the UITTabBar that is preventing me from hitting the bottom half of my custom button in another view. The button subview is on top of all other views including the custom UITabBar. It's really easy to notice this effect in ...

How to Create the Highlight/Note Popup Buttons from the iPhone Kindle

Hello All, I am wondering how Amazon did the highlight/note popup buttons in the Kindle app. After reading about UIPasteboard, UIMenuController, UIResponder, and UIResponderStandardEditActions, I am able to turn on or off standard edit actions (i.e. copy, cut, paste, select, and selectAll). However I haven't found a way to add a custom ...

Unexplained leaks using CFDictionaryRef and ABMutableMultiValueRef

The following code is creating a number of leaks which I do not understand as I release all objects created with Create or Copy. I have not worked with CF objects extensively so I may have a misunderstanding of the retention cycle. Any help would be appreciated please: ABMutableMultiValueRef webServices = ABRecordCopyValue(aRecord, kABP...

CGImageRef and drawing layers

I have this code: CGDataProviderRef provider = CGDataProviderCreateWithFilename([myFile UTF8String]); CGImageRef img = CGImageCreateWithJPEGDataProvider(provider, NULL, true, kCGRenderingIntentDefault); Later I load that CGImageRef in a UIImage this way: UIImage *uiImage = [[UIImage alloc] initWithCGImage:destImage]; I'd like to dr...

Animate the change of a stroke color on UIView

I'd like to "pulse" the stroke color on a path that I've drawn in a UIView's drawRect. But not sure this is possible? - (void)highlightView { if (!isHighlighted) { [UIView beginAnimations:NULL context:nil]; [UIView setAnimationDuration:0.75]; self.strokeColor = kHighlightColor; self.strokeWidth = 2.0; [UIVi...

How to create a Run Loop which is kicked only by performSelector... method calls?

Hey guys! I'm messing around with threads a little bit. Now consider this: I have a main thread. I start a new thread. In it's entry-point method, I want to make a run loop. Now the documentation tells meh that I have to have a input source. Otherwise my run loop exits immediately. bad. okay. but I have no other input source than my perf...

Become UIScrollViewDelegate delegate for UITableView

I have a UITableView instance variable. I want to be able to register my view controller to be the UIScrollViewDelegate for my UITableView controller. I have already tried tableView.delegate = self; But when scrolling, my methods - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView - (void)scrollViewDidEndDragging:(UISc...

Few questions: Lifecycle of UIViewController; release vs setting to nil.

I have a couple of questions relating to UIViewController: 1) When are each of the methods called for UIViewController? Specifically, the difference between viewDidLoad, viewDidUnload, and dealloc. 2) What's the difference, in general, when setting a pointer equal to nil and releasing the pointer? I know that in viewDidUnload you're su...

UITextView setText breaking hasText

So here's my code: [self.thing setText:[NSString stringWithFormat:@"Dear %@, ", name]]; For some reason, this leaves some kind of junk data in there that causes hasText to return true even if I delete everything in the textview. Ideas? ...

Strange bug caused by an assignment of an image to UIImageView

I'm working on a simple iPhone App and in some cases it has a very weird behavior which I just cannot understand... The App has an UIImageView and a few controls like a switch, label, progresbar etc. These control are initially in certain states, like the switch is off, the label contains some initial text, the progresbar is hidden. Th...

alloc-init sometimes fails in program

I am bothered by the following code snippet in my program. If I write mo=[[myObj alloc] init]; it fails, but if I write mo=[myObj alloc]; mo=[mo init]; it works. These two methods are supposed to be equivalent but somehow I am messing up. Any light? Clarifications: myObj is the name of a class It fails by trying to allocate for...

Selecting strings for UITableViewCell - array or switch statement?

When setting up a UITableView's data source, I'd be interested to get views on which is better, solution A: NSString *labelText; switch (indexPath.row) { case 0: labelText = @"Setup New Match"; break; case 1: labelText = @"Teams"; break; case 2: labelText = @"Players"; break; case 3: labelText = @"Archive"; break; }...

CFReadStreamRead blocks on the last read

Hi, I'm having trouble with a CFReadStream operation that seems to block for an extrodinarily long time after the last read. I can't seem to see anything wrong with my logic. I connect my readstream to a socket using the CFStreamCreatePairWithSocketToCFHost function. I'm sending a standard HTTP GET request over port 80 using a write str...

UIWebView resizes text after rotating: looking for explanation for magical bug or my stupidity

Hello, all, so I have UIWebView in my application and I load some html (article) to it, put some CSS to make everything nicer. That's simple and clear and everything is perfect until I try to add reading in landscape functionality and then I've noticed that UIWebView ignores any css "font-size" I've put in HTML and increases font size d...

Delegating UIScrollView doesn't work - help needed!

Hi, I'm seriously losing my hair because of simple task which turned to hell. So I have UIScrollView subclass - MyScrollView and UIViewController subclass StoryViewController using that scroll view. I need to know when scroll is scrolled so what do I do? I try to delegate! // StoryViewController.h @interface StoryViewController : UIVie...

Image vs Background image for UIButton

I have an image that is 480x331 and has a transparent background. The transparent part is just around the image's edges. My UIButton is 72x37. When I set the image as a background image in IB for the button, the transparent edges of the image show as white in the button. Without an image, the button is white with rounded corners. I'...

Cocoa-Touch: How to: custom UITableViewCell with UIColor clearColor background

I have a UITableView with custom cells. I have MyTableViewCell : UITableViewCell and MyTableViewCellContentView : UIView classes. What I'm doing is basically what is done in the AdvancedTableViewCells demo app from Apple with a slight change, on some rows I want to use a clearColor background to show the table's background behind the pa...