[textField setIntValue:5]
-(void)setIntValue:(int)anInt
-实例方法
+类方法
#import "MAFoo.h"
-(IBAction)reset:(id)sender
{
[textField setIntValue:0];
}
-(void)awakeFromNib
{
[textField setIntValue:0];
}
////////
int x=4;
int *y;
y=&x;
///////////
NSString *fav = @"hello world"
///////////
NSString *foo=@"julia!",*faa;
int slength = [foo length];
faa =[foo uppercaseString];
NSLog("length is %d",slength);
///////// 可变字符串
NSMutableString *foo,faa;
foo = [@"julia" mutableCopy];
faa = foo;
[foo appendString:@" I am happy"];
NSLog(@"Here is the result: %@.",foo);
//创建可变数组
NSMutable *array = [NSMutableArray array];
[array addObject:@"hello1"];
[array addObject:@"hello2"];
[array addObject:@"hello3"];
[array addObject:@"hello4"];
int count =[array length];//数组长度为count = 4
NSString *el =[array objectAtIndex:0];
NSLog(@"Here element at index 0 in the array is: %@.",el);
for(int i =0;i<n;i+)
{
NSString *el =[array objectAtIndex:i];
NSLog(@"Here element at index %d in the array is: %@.",i,el);
}
-(void)setIntValue:(int)anInt
-实例方法
+类方法
#import "MAFoo.h"
-(IBAction)reset:(id)sender
{
[textField setIntValue:0];
}
-(void)awakeFromNib
{
[textField setIntValue:0];
}
////////
int x=4;
int *y;
y=&x;
///////////
NSString *fav = @"hello world"
///////////
NSString *foo=@"julia!",*faa;
int slength = [foo length];
faa =[foo uppercaseString];
NSLog("length is %d",slength);
///////// 可变字符串
NSMutableString *foo,faa;
foo = [@"julia" mutableCopy];
faa = foo;
[foo appendString:@" I am happy"];
NSLog(@"Here is the result: %@.",foo);
//创建可变数组
NSMutable *array = [NSMutableArray array];
[array addObject:@"hello1"];
[array addObject:@"hello2"];
[array addObject:@"hello3"];
[array addObject:@"hello4"];
int count =[array length];//数组长度为count = 4
NSString *el =[array objectAtIndex:0];
NSLog(@"Here element at index 0 in the array is: %@.",el);
for(int i =0;i<n;i+)
{
NSString *el =[array objectAtIndex:i];
NSLog(@"Here element at index %d in the array is: %@.",i,el);
}