Locate Subviews on UI Elements
- January 24th, 2012
- Write comment
int count = 0;
for(id button in [scrollView subViews]){
if([button isKindOfClass:[UIButton class]]){
count++;
}
}
int count = 0;
for(id button in [scrollView subViews]){
if([button isKindOfClass:[UIButton class]]){
count++;
}
}
NSString *trimmedString =
[dirtyString stringByTrimmingCharactersInSet:
[NSCharacterSet whitespaceAndNewlineCharacterSet]]
I have recently found a web page which is designed on a free web space hosting while googling my name. The site was made years ago while milky way was a vast nebula. We were in university then. And belongs to one of my dearest friends another great developer Orhan Kemal Elçi.
http://members.fortunecity.com/orhiskemis/index.htm
The text is in Turkish but a masterpiece and has great historical value for me. Pay attention on the part where he emphasized the dedication of myself about projects.
tears…
Java
The elegant way
public static boolean isNumeric(String inputData) { return inputData.matches("[-+]?\\d+(\\.\\d+)?"); }
The robust way
public static boolean isNumeric(String inputData) { NumberFormat formatter = NumberFormat.getInstance(); ParsePosition pos = new ParsePosition(0); formatter.parse(inputData, pos); return inputData.length() == pos.getIndex(); }
Objective C
BOOL isNumeric(NSString *s){ NSScanner *sc = [NSScanner scannerWithString: s]; if ( [sc scanFloat:NULL] ){ return [sc isAtEnd]; } return NO; }
———————————————
source : http://rosettacode.org
Most core foundation classes has similar methods as below.
NSString *copyStr = [NSString stringWithString:originalStr];
How can you create an NSString from a char pointer?
char *cString=”Hello world”;NSString *nsString=[NSString stringWithUTF8String:cString];
Objective C does not support overloading but it has function signatures with parameter names that allows you to do something similar to overloading. It will not switch methods depending on parameter types but parameter names instead.
-(void) writeToFile:(NSString *)path fromInt:(int)anInt;
-(void) writeToFile:(NSString *)path fromString:(NSString *)aString;
Sample initializing dictionary with arrays. You may also call a single init followed by setValue methods to build your dictionary.
NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil];
NSArray *objects = [NSArray arrayWithObjects:@"How", @"are", @"you", nil];
dictionary = [NSDictionary dictionaryWithObjects:objects forKeys:keys];[dictionary setValue:@"them" forKey:@"key3"];
for (id key in dictionary) {
NSLog(@”key: %@, value: %@”, key, [dictionary objectForKey:key]);
}
After several years of under construction message everyday causing a great compunction at last I discovered there are still chips of energy in my mind to complete an up and running web site. In this site I aim to keep updates about my projects and ideas to share with people. Thank you.