#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
//实例化一个列表对象UITableView对象
UITableView *tableView=[[UITableView alloc]initWithFrame:[[UIScreen mainScreen]bounds] style:UITableViewStylePlain];//UITableViewStylePlain是控件UITableView的样式。可以选择的设置样式有两种:UITableViewStylePlain和UITableViewStyleGrouped
// [[UIScreen mainScreen]bounds]是获取整个屏幕的方法,返回为CGRect
//设置代理和数据源
tableView.delegate=self;
tableView.dataSource=self;
//将控件添加到页面上
[self.view addSubview:tableView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
//UITableView的代理协议UITableViewDataSourse中的必要实现方法之一。用来设置列表每组的行数
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section==2) {
return 3;
}
return 5;
}
//UITableView的代理协议UITableViewDataSourse中的必要实现方法之一。用来设置cell的数据
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"cell"];
if (cell == nil) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];//UITableViewCellStyleSubtitle是UITableViewCell的样式设置
}
cell.textLabel.text=@"hello";//设置行的内容
cell.detailTextLabel.text=@"hi";//设置行的副标题内容
return cell;
}
//设置tableView有多少组
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 4;
}
//设置UITableView的每组标题的内容
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return @"头部标题";
}
//设置尾部标签的内容
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
return @"尾部标题";
}
@interface ViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property(nonatomic,strong)UIImageView *imageViewIII;
@end
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// UIImageView *imageView=[[UIImageView alloc]init];
UIImageView *imageViewI=[[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 200, 200)];
imageViewI.image=[UIImage imageNamed:@"0"];
// [self.view addSubview:imageViewI];
UIImageView *imageViewII=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"4"]];
imageViewII.frame=CGRectMake(180, 100, 100, 100);
// [self.view addSubview:imageViewII];
// [self.view bringSubviewToFront:imageViewI];
_imageViewIII=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"4"] highlightedImage:[UIImage imageNamed:@"5"]];
_imageViewIII.frame=CGRectMake(20,300, 300, 200);
// _imageViewIII.highlighted=YES;
_imageViewIII.userInteractionEnabled=YES;
UITapGestureRecognizer *gestur=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(fangFa)];
[_imageViewIII addGestureRecognizer:gestur];
// _imageViewIII.center=CGPointZero;
_imageViewIII.bounds=CGRectMake(0, 0, 100, 100);
//
//
_imageViewIII.backgroundColor=[UIColor redColor];
_imageViewIII.contentMode=UIViewContentModeLeft;
_imageViewIII.transform=CGAffineTransformMakeTranslation(100, 200);
[self.view addSubview:_imageViewIII];
}
-(void)fangFa{
NSLog(@"weqeqw");
// _imageViewIII.highlighted=YES;
_imageViewIII.transform=CGAffineTransformMakeRotation(M_PI*90/180);
_imageViewIII.transform=CGAffineTransformMakeScale(0.2, 0.5);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
//加密 解密
@autoreleasepool {
NSString *str=@"kjBYYIklnBVY";
NSMutableString *jiami=[[NSMutableString alloc]init];
NSMutableArray *array = [[NSMutableArray alloc]init];
for (int i=0; i<[str length]; i++) {
char s=[str characterAtIndex:i];
int i=(int) s+1;
[array addObject:[NSString stringWithFormat:@"%i",i-1]];
if(i< 97){
i += 32;
}
char c = (char) i;
[jiami appendFormat:@"%c",c];
}
NSLog(@"加密后:%@",jiami);
NSMutableString *jiemi=[[NSMutableString alloc]init];
for (int i=0; i<[array count]; i++) {
int a=[array[i] intValue];
[jiemi appendString:[NSString stringWithFormat:@"%c",(char)a]];
}
NSLog(@"解密后:%@",jiemi);
}
return 0;