cocoa-touch

Iphone SDK touches event

Hi, I am trying to better understand touches by writing a few liner which which would track touches: - (void)drawRect:(CGRect)rect { NSLog (@"My draw"); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, 2); CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor); CG...

Is it possible to programmatically add an iPhone contact to the phone favorites?

I have an iPhone application that adds new contacts via the Address Book Framework. Is it possible to programmatically add a new or existing contact to the phone "Favorites" list? If it is possible, pointer to doc, code or API please? ...

MKMapView: Get clicked event on annotation pin

Hi, I am using a m MKMapView containing a couple of MKAnnotation pins. Above the map I am showing a UITable with detailed information of the MKAnnotation pins. My problem: When i select a pin , i would like to select the corresponding table cell. For this I would like to catch a event/delegate if the pin is selected. I am not talking a...

Language Based Scanning in a UILabel

Hello, I'm developing a twitter client (YES, another one) for the RTL languages. How can a UILabel alignment be configured depending on the language of a tweet. So if language of the tweet is Arabic for example the alignment would be UITextAlignmetRight and vice versa. ...

countForFetchRequest behavior

Hi, I'm newbie in coredata and still learning. I have an application which need to fetch number of records which fulfill given criteria. Assume I have 3 types of Entity, i.e. Entry, Tag and Attachment. Entry has to-many relationship with Tag and Attachment. Tag has to-one relationship with Entry. Attachment has to-one relationship with...

Cocoa-Touch Fun. Name the Alphanumerically Longest Method Name?

So, as I get comfortable with Cocoa/Cocoa-Touch I, like others can't help but notice the rather verbose method names. What is the absolutely longest method in Cocoa-Touch that you have come across? To kick things off, I submit that perennial favorite from UITableViewController - tableView:accessoryButtonTappedForRowWithIndexPath: Che...

How to create an Array of Strings in Objective c for iphone

I'm trying to create an array of strings that can be randomized and limited to a certain x number of strings. If the array could be randomized I could pick the first x strings and that would work fine. I'm trying to use code like this currently NSString *statements[9]; statements[0] = @"hello"; This seems to work but the array seems...

Cocoa-Touch: UITableView not resizing

I have an app, which has a top navigation bar and a bottom tab bar. One of the tabs displays a table's XIB file with my custom controller. This UITableView is created by a MyTableViewController class. I have a problem with the table's size. The table's frame size is bad (it's the fullscreen iphone size, without the status/tab/navigat...

How can I detect a permanent collision with the Chipmunk Physics engine

I'm trying to play a "boing" sound when a ball shape hit's any other kind of shape. Which works. But works a little too well.... When the ball comes to rest, or starts to roll, it's in a permanent collision with whatever it's touching, so the "boing" sound fires constantly. I can't find anything in the chipmunk documentation to tell m...

How to get a UITextView to autosize within a UITableViewCell

Setup: I have a UITextView inside a UITableViewCell's contentView. I want it to take up the full size of the cell. I create the text view like so: UITextView *textView = [[[UITextView alloc] initWithFrame:CGRectMake(0,0,268,43)] autorelease]; textView.backgroundColor = [UIColor redColor]; textView.layer.cornerRadius = 10; textView.au...

iPhone Performance Differences in Quartz Drawing vs. Pre-Baked Images (which I guess simplifies to Quartz vs. Quartz)

New to Quartz and I am curious on the drawing speeds of simple shapes, gradients, and shadows; specifically comparing Quartz drawing functions to Quartz image drawing on the iPhone. Say that I need to draw a filled, stroked, and shadowed rectangle. I'm assuming that importing a pre-baked rect as a PNG and drawing it using drawInRect: o...

ScrollOffset in UIWebView?

Hello, I'm having a really hard time understanding delegates and object inheritance (if I may use this word) and I think I need a simple (or so I think) thing: catch scrollViewDidScroll event in UIWebView and get offset (basically, just to know if scroll is not on top/bottom, so I could hide navigation and tab bars). Is there any way I...

iPhone One controller, multiple views

Hi I'm rather new to iPhone development, and am wondering how to load multiple views from a single controller. I come from a c# background and still trying to get my head around how things work in ObjC and the iPhone worlds. As a basic example of what I am trying to achieve, lets say I have a ClockController, the clock controller has ...

Sort NSArray by NSDate, today

Hi, I have loaded item from core data in an NSMutableArray. Each item, when created, is given a due date, that the user choices. How do I sort, so only the item that is due today is displayed? Here is what I got so far: NSPredicate *predicate = [NSPredicate predicateWithFormat: @"dueDate == %@", [NSDate date]]; [allObjectsArray ...

Objective C - Problem with NSMutableArray and NSTableView

I have a class named Person and in this class is the property PersonName (amongst others). A MutableArray MyUserInfoArr contains many Person objects. I want to list each PersonName in a Cell of a TableView? How do I do this? Thanks in advance. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath ...

Cocoa Touch - how do I correctly assign a new value to a pointer w/o causing a memory leak?

I've just completed my first simple iPhone app; I'm using Instruments to find memory leaks. I am a little lost as to how to reuse pointers. I have read the Apple documentation, but I still don't understand the correct procedure. The Apple docs say, "Another typical memory leak example occurs when a developer allocates memory, assigns ...

UIScrollView scrollbar disappearing when using setScrollIndicatorInsets:

I am trying to reposition my scrollbar in a subclass of UIScrollView. According to the API docs this should be as simple as: [gridView setScrollIndicatorInsets:UIEdgeInsetsMake(0,0,0,10)]; However when I pass anything to this setter that is not UIEdgeInsetsZero, the scrollbar completely disappears. The scrollbar I am trying to move...

cellForRowAtIndexPath not called; sections returns 1 and rows returns 4

After parsing JSON data in a Data class, I set the UIViewController's NSArray *headlines property in a fillArrays method of the same Data class. In the viewDidAppear method of my UIViewController, I call reloadData on my UITableView. numberOfSectionsInTableView fires and returns 1, then numberOfRowsInSection fires and returns an array co...

Will the system send an NSWillBecomeMultiThreadedNotification when I create POSIX threads?

I tried it, but I think this notification isn't coming. Is that the normal case? ...

Custom UITextField/UIButton

What I'm trying to do is replicate the NSTokenField like UITextField seen in the Mail app and Messages app (type a contact and it comes up with suggestions). I've got the autocompleting working perfectly, when you type in a UITextField, a UITableView pops up showing any matches that it can find in an array, when you click one it adds it...