Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
- UICollectionViewFlowLayout *layout=[[UICollectionViewFlowLayout alloc] init];
- _collectionView=[[UICollectionView alloc] initWithFrame:CGRectMake(130, 100, 780, 1024) collectionViewLayout:layout];
- _collectionView.autoresizesSubviews= YES;
- [_collectionView setDataSource:self];
- [_collectionView setDelegate:self];
- _collectionView.backgroundColor = [UIColor clearColor];
- [_collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cellIdentifier"];
- [self.view addSubview:_collectionView];
- /*
- for (int i=0; i<12; i+=2) {
- NSIndexPath *index = [NSIndexPath indexPathForItem:i inSection:0];
- NSIndexPath *index1 = [NSIndexPath indexPathForItem:i+1 inSection:0];
- [_collectionView moveItemAtIndexPath:index toIndexPath:index1];
- }
- for (int i=2; i<12; i+=2) {
- NSIndexPath *index = [NSIndexPath indexPathForItem:i inSection:0];
- NSIndexPath *index1 = [NSIndexPath indexPathForItem:i+1 inSection:0];
- [_collectionView moveItemAtIndexPath:index toIndexPath:index1];
- }
- */
- }
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
- {
- return 12;
- }
- -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
- {
- return 1;
- }
- - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath];
- UIView *headertitle = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 375, 20)];
- UILabel *titlelabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 20)];
- titlelabel.text = [NSString stringWithFormat:@"graphtitle%d",indexPath.row];
- titlelabel.textColor = [UIColor blackColor];
- titlelabel.font = [UIFont fontWithName:@"Knewave" size:15.0f];
- titlelabel.backgroundColor = [UIColor clearColor];
- [headertitle addSubview:titlelabel];
- headertitle.backgroundColor = [UIColor whiteColor];
- UIWebView *web = [[ UIWebView alloc]initWithFrame:CGRectMake(0, 20, 375, 150)];
- NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"];
- NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile];
- web.scalesPageToFit = YES;
- [web loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]];
- UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
- button1.backgroundColor = [UIColor clearColor];
- button1.frame = CGRectMake(320, 3, 50, 17);
- [button1 setTitle:@"view" forState:UIControlStateNormal];
- [headertitle addSubview:button1];
- headertitle.backgroundColor = [UIColor grayColor];
- [cell addSubview:headertitle];
- [cell addSubview:web];
- cell.layer.shadowColor = [[UIColor blackColor]CGColor];
- cell.layer.shadowOffset = CGSizeMake(20, 20);
- cell.layer.borderColor = [[UIColor blackColor] CGColor];
- cell.layer.borderWidth =1;
- //cell.alpha = 0;
- return cell;
- }
- -(CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
- {
- return 10;
- }
- - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
- {
- return CGSizeMake(377, 172);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement