For #1, this seems to imply you can use setDelegate: and get a segmentedControl:selectedSegmentChanged: message:
#91844 - Pastie
For #2, you could filter strings with a help message like this:
Code:
@implementation NSString (SCW)
- (NSString*) stringWithCharactersInSet: (NSCharacterSet*)aSet {
NSScanner *sc = [NSScanner scannerWithString: self];
NSMutableString *ans = [NSMutableString stringWithCapacity: (int)([self length]*0.9)];
while (![sc isAtEnd]) {
NSString *work = @"";
if ([sc scanCharactersFromSet: aSet intoString: &work])
[ans appendString: work];
[sc scanUpToCharactersFromSet: aSet intoString: NULL];
}
return [NSString stringWithString: ans];
}
@end