Skip to content

Commit

Permalink
add LICENSE and submit to cocoa pods
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisXu committed Jul 12, 2013
1 parent 4335579 commit ea1c6a8
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 2 deletions.
15 changes: 15 additions & 0 deletions CXPhotoBrowser.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Pod::Spec.new do |s|
s.name = "CXPhotoBrowser"
s.version = "1.0.0"
s.summary = "A photo browser supporting with high level customization"
s.description = <<-DESC
Inspiring by @MWPhotoBrowser. Removing the dependcy with other library, so you can choose your favorite Async library to download image online. Supporting with high level of customization, including Navigationbar, Toolbar, Loading process placeholder and Loading failure placeholder. You can build a photo browser similar to facebook.
DESC
s.homepage = "https://github.com/ChrisXu1221/CXPhotoBrowser"
s.license = 'MIT'
s.author = { "ChrisXu" => "taterctl@gmail.com" }
s.source = { :git => "https://github.com/ChrisXu1221/CXPhotoBrowser.git", :tag => "1.0.0" }
s.source_files = 'CXPhotoBrowser/*.{h,m}'
s.platform = :ios, '4.3'
s.requires_arc = true
end
16 changes: 16 additions & 0 deletions CXPhotoBrowser/CXPhotoBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
#import "CXPhotoLoadingView.h"
#import "CXBrowserNavBarView.h"
#import "CXBrowserToolBarView.h"

typedef enum
{
CXPhotoStartLoading = 0,
CXPhotoFinishLoading = 1,
CXPhotoDidFailLoading = 2
}CXPhotoLoadingStatus;

@protocol CXPhotoBrowserDataSource;
@protocol CXPhotoBrowserDelegate;
@interface CXPhotoBrowser : UIViewController
Expand Down Expand Up @@ -42,6 +50,8 @@
// Navigation & control / Hiding / Showing
- (void)setToolBarViewsHidden:(BOOL)hidden animated:(BOOL)animated;

//Reload
//- (void)reloadCurrentPhoto; undone
@end

@protocol CXPhotoBrowserDataSource <NSObject>
Expand Down Expand Up @@ -104,4 +114,10 @@
*/
- (void)photoBrowser:(CXPhotoBrowser *)photoBrowser didChangedToPageAtIndex:(NSUInteger)index;

/**
@param photoBrower The current photobrowser to present.
@param index The current showing index in photoBrowser.
@param status
*/
- (void)photoBrowser:(CXPhotoBrowser *)photoBrowser currentPhotoAtIndex:(NSUInteger)index didFinishedLoadingWithStatus:(CXPhotoLoadingStatus)status;
@end
28 changes: 28 additions & 0 deletions CXPhotoBrowser/CXPhotoBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ - (void)setToolBarHidden:(BOOL)hidden animated:(BOOL)animated;
// Data
- (NSUInteger)numberOfPhotos;
- (id<CXPhotoProtocol>)photoAtIndex:(NSUInteger)index;
- (NSUInteger)indexOfPhoto:(id<CXPhotoProtocol>)photo;
- (UIImage *)imageForPhoto:(id<CXPhotoProtocol>)photo;
- (void)loadAdjacentPhotosIfNecessary:(id<CXPhotoProtocol>)photo;
- (void)unloadAllUnderlyingPhotos;
Expand Down Expand Up @@ -664,6 +665,16 @@ - (void)setToolBarViewsHidden:(BOOL)hidden animated:(BOOL)animated

}

//Reload
- (void)reloadCurrentPhoto
{
id <CXPhotoProtocol> currentPhoto = [self photoAtIndex:_currentPageIndex];
if ([currentPhoto underlyingImage]) {
// photo loaded so load ajacent now
[self loadAdjacentPhotosIfNecessary:currentPhoto];
}
}

// Navigation
- (void)currentPageDidUpdated
{
Expand Down Expand Up @@ -832,6 +843,21 @@ - (NSUInteger)numberOfPhotos
return photo;
}

- (NSUInteger)indexOfPhoto:(id<CXPhotoProtocol>)photo
{
NSUInteger index = 0;
for (int i = 0; i < _photos.count; i++)
{
if ([[_photos objectAtIndex:i] isEqual:photo])
{
index = i;
break;
}
}
NSLog(@"%i,%i",index,_currentPageIndex);
return index;
}

- (UIImage *)imageForPhoto:(id<CXPhotoProtocol>)photo
{
if (photo) {
Expand Down Expand Up @@ -880,6 +906,8 @@ - (void)handleCXPhotoImageDidStartLoad:(NSNotification *)notification
{
id <CXPhotoProtocol> photo = [notification object];
//show loading view
NSUInteger index = [self indexOfPhoto:photo];

CXZoomingScrollView *page = [self pageDisplayingPhoto:photo];
if (page)
{
Expand Down
4 changes: 2 additions & 2 deletions CXPhotoBrowserDemo/CXPhotoBrowserDemo-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>1.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2013 Chris Xu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

0 comments on commit ea1c6a8

Please sign in to comment.