Skip to content

Commit

Permalink
Web complete commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuclominus committed Mar 28, 2014
1 parent 4bfaffe commit c0b5d47
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion PhotoWall.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@
F02EC92818E18A970054C833 /* ViewController.h */,
F02EC92918E18A970054C833 /* ViewController.m */,
F0B32CAE18E4499B008E9AD2 /* CellVC.h */,
F0B32CAF18E4499B008E9AD2 /* CellVC.m */,
F0B32CB018E4499B008E9AD2 /* CellVC.xib */,
F02EC92B18E18A970054C833 /* Images.xcassets */,
F0B32CAF18E4499B008E9AD2 /* CellVC.m */,
F02EC91718E18A960054C833 /* Supporting Files */,
);
path = PhotoWall;
Expand Down
18 changes: 9 additions & 9 deletions PhotoWall/ViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
int stroke;
int line;
}
@property(nonatomic) BOOL firstTime;
@property(nonatomic) BOOL firstShow;
@property(nonatomic,strong) NSMutableArray * cellsArray;
@property(nonatomic,strong) id delegate;
@property(nonatomic,strong) IBOutlet UIView * mainView;
@property(nonatomic,strong) IBOutlet UIScrollView * scrollView;
@property(nonatomic,strong) IBOutlet UIView * contentView;
@property(nonatomic,strong) NSMutableArray * dataArray;

@property(nonatomic) BOOL firstTime;
@property(nonatomic) BOOL firstShow;
@property(nonatomic,strong) NSMutableArray * cellsArray;
@property(nonatomic,strong) id delegate;
@property(nonatomic,strong) IBOutlet UIView * mainView;
@property(nonatomic,strong) IBOutlet UIScrollView * scrollView;
@property(nonatomic,strong) IBOutlet UIView * contentView;
@property(nonatomic,strong) NSMutableArray * dataArray;
@property(nonatomic) CGPoint lastContentOffset;
@property(nonatomic, strong) IBOutlet UIScrollView *scroll;
@property(nonatomic, strong) NSMutableArray * pointsArray;

Expand Down
10 changes: 9 additions & 1 deletion PhotoWall/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,14 @@ -(void)removePointsAfterAddElement{
}
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
_lastContentOffset = scrollView.contentOffset;
}

-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
NSLog(@"Scroll veloscity x = %f, y = %f",_scroll.contentOffset.x ,_scroll.contentOffset.y);
CGRect screenRect = CGRectMake(scrollView.contentOffset.x, scrollView.contentOffset.y, SCREEN_W, SCREEN_H);
self.lastContentOffset = scrollView.contentOffset;

// проверка и добавление новых ячеек
NSUInteger count = _cellsArray.count;
Expand All @@ -145,10 +150,12 @@ -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
NSMutableArray * cellarray = cell.adjacentPoints;
for (int j = 0; j<cellarray.count-1;j++) {
NSValue* pointValue = ((NSValue*)cellarray[j]);
// попадает ли точка в экран
if (CGRectContainsPoint(screenRect,pointValue.CGPointValue)) {
// проверяем не зянята ли точка
if (![_pointsArray containsObject:(NSValue*)cellarray[j]]) {
CellVC * viewPoint = [[CellVC alloc]init];
[viewPoint.view setFrame:CGRectMake(pointValue.CGPointValue.x+75,pointValue.CGPointValue.y+75, 150, 150)];
[viewPoint.view setFrame:CGRectMake(pointValue.CGPointValue.x-75,pointValue.CGPointValue.y-75, 150, 150)];
[viewPoint.view setBackgroundColor:[UIColor blackColor]];
viewPoint.view.tag = iterator;
// тестовая картинка
Expand All @@ -172,6 +179,7 @@ -(void)scrollViewDidScroll:(UIScrollView *)scrollView{
}
}


-(void)removePointFromArrays:(CGPoint)point{
// удаление точек размещенных ячеек
for (int j = 0; j<_cellsArray.count-1;j++) {
Expand Down

0 comments on commit c0b5d47

Please sign in to comment.