objective-c

UIActionSheet Tinting

Anyone know anyway to tint uiactionsheet in uikit? ...

Objective C Structs and Memory Management

Simple question - do i need to free or release structs. My reason for asking is that I'm use a NSInvocation and the SEL type is a struct. Just want to know if I need to release it. Thanks. ...

Run javascript without UIWebView possible?

Is it possible to run some javascript code (having perhaps an NSString as input) without using a UIWebView? I would like to run this code in a separate thread so UIWebView is not possible and I don't really want to render anything, just get back the results. ...

Reasons to use NSString constants over enums?

I'm wondering why Apple is using (quite heavily in CoreAnimation, but elsewhere too) constants that are declared as NSString * const like for example kCAGravityTop instead of regular enums? How about type safety in this case? As I understand it, one could pass any NSString to a method expecting this constant without getting any compiler ...

Creating a Navigation View inside the standard Flipside view?

Does anyone know how to create a Navigation View inside a standard Flipside View to read and update settings? If so, can you post some code on doing this. ...

Working with multi-page images in an NSImage

I'm working on an image viewer application (OSX) and currently it can load and view images, but I need to be able to view multi-page PDFs and TIFFs. I'll have next/previous page buttons, etc. Now, with PDF, I expect to use an NSPDFImageRep. This will let me set the current page and draw the current page etc. However, I don't see an NST...

How do I compare strings in objective c?

I want to compare the value of an NSString to the string "Wrong". Here is my code: NSString *wrongTxt = [[NSString alloc] initWithFormat:@"Wrong"]; if( [statusString isEqualToString:wrongTxt]){ doSomething; } Do I really have to create an NSString for "Wrong"? Also, can I compare the value of a UILabel.text to a string without ...

Touch Controls working on Simulator, not on Device

See topic. It's just with one application -- 2 of them work fine, but the third (and largest, go figure) doesn't respond to touch events. I tried changing a UIImageView's location on TouchesBegan, and that doesn't show up (but it does in the Simulator!) -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch =...

Two-finger rotation gesture on the iPhone?

I'm working on an iPhone app with a lot of different gesture inputs that you can do. Currently there is single finger select / drag, two finger scroll, and two finger pinch zoom-in / zoom-out. I want to add in two finger rotation (your fingers rotate a point in between them), but I can't figure out how to get it to work right. All the ot...

Algorithm for determining minimum bounding rectangle for collection of lat/lon coordinates

I need some help coming up with an algorithm to determine the minimum bounding rectangle around a set of lat/lon coordinates. It is OK to assume a flat earth since the coordinates will not be too far apart. Pseudocode is OK, but if someone has done this in objective-C, that would be even better. What I am trying to do is set the zoom ...

performSelector for heterogeneous items in an Array causing NSInvalidArgumentException

My NSArray holds two different types of classes, both of which derive from NSObject and have a method with the same name. If I call: [myArrayList makeObjectsPerformSelector:@selector(dehydrate) withObject:myParamObjec]; I get the 'unrecognized selector' exception: uncaught exception 'NSInvalidArgumentException', r...

indentationLevel property doesn't appear to do anything?

I'm have a number rows I'm inserting into a table using -insertRowsAtIndexPaths:withRowAnimation, and I would like the rows to be indented from the left to distinguish them from the rest of the cells. The indentationLevel property of UITableViewCell looks like it's exactly what I need, but it doesn't seem to do anything. Here's the code ...

List of all users and groups

I'm trying to get a list of all users and all groups on Mac OS X 10.5+. How can I do this? For example, the list of all users on my machine should return: _amavisd, _appowner, _appserver, _ard, _atsserver, _calendar, _carddav, _clamav, _coreaudiod, _cvmsroot, _cvs, _cyrus, _devdocs, _dovecot, _eppc, _installer, _jabber, _lda, _locatio...

Adjusting the positions of the labels in a UITableViewCell

I'm using a UITableViewCell with UITableViewCellStyleSubtitle. However, because of the background image I'm using for the cell, I don't like where the detailTextLabel is going. I want to move it and resize it within the cell, but nothing I try seems to work. CGRect currRect = cell.detailTextLabel.frame; cell.detailTextLabel.frame = CGRe...

Conditions when drawRect's rect != self.frame

I have a UIView subclass that I am doing some custom drawing in. When drawRect:(CGRect)rect is getting called rect.size is either (64, 63) or (63, 64); self.frame.size is (64, 64). I have multiple instances of this subclass, most of which get the expected (64, 64) size for the drawRect parameter. What are conditions that may cause some...

objective c difference between id and void *

In objective C what is the difference between id and void *? Thanks. ...

iPhone restrict user from entering space in textfield

hi , i want to restrict user from entering space in a UITextField. for this i m using this code - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { if ( string == @" " ){ UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"You hav...

How to customize the content of each page using Page Control and UIScrollView?

I have problem with customizing each page using pagecontrol and UIScrollView. I'm customizing Page Control from Apple. Basically I would like to have each page different with text and image alternately on different page. Page 1 will have all text, Page 2 will have just images, Page 3 will have all text and goes on. This is original cod...

append text with UITextField text

I am running Objective-C/Cocoa in Shell in Windows, not on Mac OS X. Now, I want to append a string with an existing string in a text field when I click a button. I've created a button in a window, but I don't know how to append a string when I click that button. How can I append a string to a text field when that button is clicked? ...

Use specific localization in Cocoa app

How can you make your cocoa app use a specific locale / localization thats different from what the current locale says? My app has a number of localizations and I would like to be able to choose the localization the app uses in a config file. How can I tell Cocoa which of the localizations to use? ...