今天闲来无事研究了下拼图,不多说,附代码
原图和效果图如下:
#define SPACE 2 //小图边距
#define NUMBER 3 //拼图横竖个数
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self creatView];
[self segmentImage];
}
//创建背景视图
- (void)creatView
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(9, 42, 302, 302)];
view.backgroundColor = [UIColor magentaColor];
view.tag = 1