#define degreesToRadians(x) (M_PI * x / 180.0)

[UIView animateWithDuration:0.25 delay:0.0 options:UIViewAnimationCurveEaseOut
animations:^{
object.transform = CGAffineTransformRotate(object.transform, degreesToRadians(90));
} completion:nil
];

See https://github.com/jimsblogfiles/RotateSomething for project & files

NSString *dirtyString = @”I just want text @#$!”;
NSCharacterSet *nonAlphaNumericSet = [[ NSCharacterSet alphanumericCharacterSet ] invertedSet ];

NSString *cleanString = [[ dirtyString componentsSeparatedByCharactersInSet:nonAlphaNumericSet ] componentsJoinedByString:@”" ];

NSLog(@”>%@”, cleanString);

2012-02-12 22:29:24.645 Untitled 2[9145:707] >Ijustwanttext

//viewdidload or similar
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleUpdateRequest:) name:@”myObject” object:nil];

////////////////////////////////////////////////////
////////// FROM A BUTTON

//button action or similar
-(IBAction)doSomething:(id)sender {

[[NSNotificationCenter defaultCenter] postNotificationName:@”myObject” object:sender];

}

//handler
-(void)handleUpdateRequest:(NSNotification *)notif {

NSLog(@”>>>%i”,[notif.object tag]);

}

OR

////////////////////////////////////////////////////
////////// TABLE CELL

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

NSNumber *indexPath_row = [[NSNumber alloc] initWithInt:indexPath.row];
[[NSNotificationCenter defaultCenter] postNotificationName:@”myObject” object:indexPath_row];

}

//handler
-(void)handleUpdateRequest:(NSNotification *)notif {

NSLog(@”>>>%i”,[notif.object intValue]);

}

NSMutableArray *imageArray = [[NSMutableArray alloc]init];

for (int i = 1; iy <= 40; i++) {
[imageArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"s%02i.png", i]]];
}

UIImageView * ryuJump = [[[UIImageView alloc] initWithFrame:
CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)]autorelease];
ryuJump.animationImages = imageArray;
ryuJump.animationDuration = 2.1;
ryuJump.contentMode = UIViewContentModeCenter;

[someview addSubview:ryuJump];

[ryuJump startAnimating];
[imageArray release];

-(NSString*)urlEncoded:(NSString*)str {

NSString *escapedUrlString = [str stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
return escapedUrlString;

}

-(NSString*)urlDecoded:(NSString*)str {

NSString *cleanUrlString = [str stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
return cleanUrlString;

}

NSString *devStr = @”http://localhost/dri/json?foo=#bar&something=true&miscc=Foo bar!”;

NSLog(@”devStr: %@”,devStr);

NSString *encString = [self urlEncoded:devStr];
NSLog(@”encString: %@”,encString);

NSString *decString = [self urlDecoded:encString];
NSLog(@”decString: %@”,decString);

UIImage *image = [UIImage imageNamed:@"greatimage.png"];
UIImageView *imgView = [[UIImageView alloc] initWithImage:image];
imgView.frame = CGRectMake(0, 0, 320, 90);
[self.view addSubview:imgView];
[imgView release];

// a button
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(targetMethod:) forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(0.0, 0.0, 160.0, 40.0);
[self.view addSubview:button];

////////////////////////////////////////
// Button with background images
////////////////////////////////////////

UIButton *bttn = [UIButton buttonWithType:UIButtonTypeCustom];
bttn.frame = CGRectMake(0, 200, 97, 38);
[bttn setTitle:@"Dev One" forState:UIControlStateNormal];
[bttn addTarget:self action:@selector(targetMethod:) forControlEvents:UIControlEventTouchUpInside];

UIImage *bttnImageNormal = [UIImage imageNamed:@"button.png"];
[bttn setImage:bttnImageNormal forState:UIControlStateNormal];

UIImage *bttnImageSelected = [UIImage imageNamed:@"button-selected.png"];
[bttn setImage:bttnImageSelected forState:UIControlStateHighlighted];

[self.view addSubview:bttn];

-(IBAction)targetMethod:(id)sender {

NSLog(@”targetMethod”);

}

© 2012 James Border Suffusion theme by Sayontan Sinha