This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { | |
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | |
if (self) { | |
self.backCell = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.frame.size.width, 80.0)]; | |
UIImageView *cellBackBkgView = [[UIImageView alloc] init]; | |
cellBackBkgView.backgroundColor = [UIColor whiteColor]; | |
sunImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 27.5, 25.0, 25.0)]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { | |
[super touchesBegan:touches withEvent:event]; | |
UITouch *touch = [touches anyObject]; | |
firstTouch = [touch locationInView:self]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { | |
[super touchesMoved:touches withEvent:event]; | |
if (slideEnabled == NO) return; | |
[self toggleTableScrolling:NO]; | |
UITouch *touch = [touches anyObject]; | |
CGPoint touchPoint = [touch locationInView:self]; | |
CGRect frame = frontCell_.frame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { | |
[super touchesEnded:touches withEvent:event]; | |
if (SlideDistance == kDragDistance) { | |
NSLog(@"太陽さんさ〜ん!"); | |
} else if (SlideDistance == -kDragDistance) { | |
NSLog(@"三日月おつきさま!"); | |
} | |
[self springBack]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { | |
[super touchesCancelled:touches withEvent:event]; | |
[self springBack]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)springBack { | |
slideEnabled = NO; | |
CGRect frame = frontCell_.frame; | |
frame.origin = CGPointMake(0, 0); | |
[UIView animateWithDuration:0.1 | |
delay: 0.0 | |
options: UIViewAnimationOptionCurveEaseOut | |
animations:^{ | |
frontCell_.frame = frame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *CellIdentifier = @"Cell"; | |
SlidingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
if (cell == nil) { | |
cell = [[SlidingTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { | |
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | |
if (self) { | |
self.backCell = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.frame.size.width, 80.0)]; | |
UIImageView *cellBackBkgView = [[UIImageView alloc] init]; | |
cellBackBkgView.backgroundColor = [UIColor whiteColor]; | |
sunImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 27.5, 25.0, 25.0)]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { | |
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | |
if (self) { | |
self.backCell = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.frame.size.width, 80.0)]; | |
UIImageView *cellBackBkgView = [[UIImageView alloc] init]; | |
cellBackBkgView.backgroundColor = [UIColor whiteColor]; | |
sunImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 27.5, 25.0, 25.0)]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)panGesture:(UIPanGestureRecognizer *)sender { | |
if (sender.state == UIGestureRecognizerStateBegan) { | |
startPoint = [sender locationInView:frontCell_]; | |
} | |
if (sender.state == UIGestureRecognizerStateChanged) { | |
CGPoint nowPoint = [sender locationInView:frontCell_]; | |
if (slideEnabled == NO) return; |
OlderNewer