Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: facebookarchive/three20
...
head fork: a4agarwal/three20
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
36 src/TTPhotoViewController.m
@@ -86,6 +86,7 @@ - (void)updateChrome {
playButton.enabled = _photoSource.numberOfPhotos > 1;
_previousButton.enabled = _centerPhotoIndex > 0;
_nextButton.enabled = _centerPhotoIndex >= 0 && _centerPhotoIndex < _photoSource.numberOfPhotos-1;
+ _deleteButton.enabled = _photoSource.numberOfPhotos > 0;
}
- (void)updateToolbarWithOrientation:(UIInterfaceOrientation)interfaceOrientation {
@@ -267,6 +268,33 @@ - (void)previousAction {
}
}
+
+- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
+{
+ if (!buttonIndex == [actionSheet cancelButtonIndex])
+ {
+ //NSLog([NSString stringWithFormat:@"%d", _scrollView.centerPageIndex]);
+ [_photoSource deletePhotoAtIndex:_scrollView.centerPageIndex];
+ //[self previousAction];
+ [self showActivity:nil];
+ [self moveToNextValidPhoto];
+ [_scrollView reloadData];
+ [self refresh];
+ }
+}
+
+- (void)deleteAction {
+ UIActionSheet *actionSheet = [[UIActionSheet alloc]
+ initWithTitle:@"Are you sure you want to delete this photo?"
+ delegate:self
+ cancelButtonTitle:@"Cancel"
+ destructiveButtonTitle:@"OK"
+ otherButtonTitles: nil];
+
+ [actionSheet showInView:self.view];
+ [actionSheet release];
+}
+
- (void)showBarsAnimationDidStop {
self.navigationController.navigationBarHidden = NO;
}
@@ -304,6 +332,7 @@ - (id)init {
_captionStyle = nil;
_nextButton = nil;
_previousButton = nil;
+ _deleteButton = nil;
_statusText = nil;
_thumbsController = nil;
_slideshowTimer = nil;
@@ -365,6 +394,10 @@ - (void)loadView {
TTIMAGE(@"bundle://Three20.bundle/images/previousIcon.png")
style:UIBarButtonItemStylePlain target:self action:@selector(previousAction)];
+ _deleteButton = [[UIBarButtonItem alloc] initWithImage:
+ TTIMAGE(@"bundle://Three20.bundle/images/deleteIcon.png")
+ style:UIBarButtonItemStylePlain target:self action:@selector(deleteAction)];
+
UIBarButtonItem* playButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:
UIBarButtonSystemItemPlay target:self action:@selector(playAction)] autorelease];
playButton.tag = 1;
@@ -378,7 +411,7 @@ - (void)loadView {
_toolbar.barStyle = self.navigationBarStyle;
_toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleTopMargin;
_toolbar.items = [NSArray arrayWithObjects:
- space, _previousButton, space, _nextButton, space, nil];
+ space, _previousButton, space, _nextButton, space, _deleteButton, nil];
[_innerView addSubview:_toolbar];
}
@@ -391,6 +424,7 @@ - (void)viewDidUnload {
TT_RELEASE_SAFELY(_photoStatusView);
TT_RELEASE_SAFELY(_nextButton);
TT_RELEASE_SAFELY(_previousButton);
+ TT_RELEASE_SAFELY(_deleteButton);
TT_RELEASE_SAFELY(_toolbar);
}
View
BIN  src/Three20.bundle/images/deleteIcon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
5 src/Three20/TTPhotoSource.h
@@ -40,6 +40,11 @@ typedef enum {
*/
- (id<TTPhoto>)photoAtIndex:(NSInteger)index;
+/**
+ *
+ */
+- (void)deletePhotoAtIndex:(NSInteger)index;
+
@end
///////////////////////////////////////////////////////////////////////////////////////////////////
View
3  src/Three20/TTPhotoViewController.h
@@ -6,7 +6,7 @@
@class TTScrollView, TTPhotoView, TTStyle;
@interface TTPhotoViewController : TTModelViewController
- <TTScrollViewDelegate, TTScrollViewDataSource, TTThumbsViewControllerDelegate> {
+ <TTScrollViewDelegate, TTScrollViewDataSource, TTThumbsViewControllerDelegate, UIActionSheetDelegate> {
id<TTPhotoSource> _photoSource;
id<TTPhoto> _centerPhoto;
NSInteger _centerPhotoIndex;
@@ -16,6 +16,7 @@
UIToolbar* _toolbar;
UIBarButtonItem* _nextButton;
UIBarButtonItem* _previousButton;
+ UIBarButtonItem* _deleteButton;
TTStyle* _captionStyle;
UIImage* _defaultImage;
NSString* _statusText;

No commit comments for this range

Something went wrong with that request. Please try again.