objective-cでよく使われるコントロール.

5295 ワード

/***********UIButton***************/
// button  UIButtonTypeCustom   UIButtonTypeRoundedRect  
 UIButton * testbutton = [UIButton buttonWithType:UIButtonTypeCustom];

// button 
 [testbutton setTitle:@" "  forState:UIControlStateNormal];

// 
 [testbutton addTarget:self action:@selector(exitselview:) forControlEvents:UIControlEventTouchUpInside];

// button for  ......... button tag 。 。
testbutton.tag = 0;

// button    
if( ((UIButton*)sender).tag ==N)
{
     ......
}
else
{
    .......
}

 
 
 
/*********NSMutableArray **********/
// array
NSMutableArray *testArray = [NSMutableArray arrayWithObjects:@"111111",@"22222",@"3333",@"4444",nil];

// 
[testArray objectAtIndex:0]

 
 // 
UIScrollView * testview1 = [[UIScrollView alloc]init];
//alloc  。 1
NSLog(@"retainCount1:%d",[testview1 retainCount]);
    
// 1
[testview1 retain];
 NSLog(@"retainCount2:%d",[testview1 retainCount]);
    
//release  。 1 。 0 。 
[testview1 release];
NSLog(@"retainCount3:%d",[testview1 retainCount]);

 
// , hideAnimationStopped 
 [UIView setAnimationDidStopSelector:@selector(hideAnimationStopped)];

 
 
//opacity  
CABasicAnimation *testAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
    // 0~1  。
testAnimation.fromValue = [NSNumber numberWithFloat:1];
    //   。。 。 
testAnimation.toValue =[NSNumber numberWithFloat:-0.5];
testAnimation.duration = 3.0;

 
 
//CABasicAnimation    。 

-(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
    [self tooverview];
}

 
qingjoin