diff --git a/adam.xcodeproj/project.pbxproj b/adam.xcodeproj/project.pbxproj index bbedaf1..2441343 100644 --- a/adam.xcodeproj/project.pbxproj +++ b/adam.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ 21D741281B21A9A9008A8EB5 /* DiscoverView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 21D741271B21A9A9008A8EB5 /* DiscoverView.xib */; }; 21D7412A1B21AA4B008A8EB5 /* DiscoverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D741291B21AA4B008A8EB5 /* DiscoverView.swift */; }; 21D7412C1B21AD36008A8EB5 /* DiscoverViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D7412B1B21AD36008A8EB5 /* DiscoverViewController.swift */; }; + 96157CD01B41AB240022E3F0 /* LoadingIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96157CCF1B41AB240022E3F0 /* LoadingIndicator.swift */; }; 9616799B1B2C72BA00A43AD3 /* LocationSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9616799A1B2C72BA00A43AD3 /* LocationSearchViewController.swift */; }; 964690861B3308D800DB187D /* TutorialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 964690851B3308D800DB187D /* TutorialViewController.swift */; }; 9646908A1B3392F600DB187D /* PageContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 964690891B3392F600DB187D /* PageContentViewController.swift */; }; @@ -71,6 +72,7 @@ 21D741291B21AA4B008A8EB5 /* DiscoverView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiscoverView.swift; sourceTree = ""; }; 21D7412B1B21AD36008A8EB5 /* DiscoverViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DiscoverViewController.swift; sourceTree = ""; }; 5BD10A0AA37B5DD5EB928422 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; + 96157CCF1B41AB240022E3F0 /* LoadingIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingIndicator.swift; sourceTree = ""; }; 9616799A1B2C72BA00A43AD3 /* LocationSearchViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationSearchViewController.swift; sourceTree = ""; }; 964690851B3308D800DB187D /* TutorialViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TutorialViewController.swift; sourceTree = ""; }; 964690891B3392F600DB187D /* PageContentViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PageContentViewController.swift; sourceTree = ""; }; @@ -183,6 +185,7 @@ 9656AD9B1AECC62800933A8E /* benri */ = { isa = PBXGroup; children = ( + 96157CCF1B41AB240022E3F0 /* LoadingIndicator.swift */, 21A29D331B3A6166009E0D0C /* MapViewController.swift */, 96E377191B35981100229684 /* Localizable.strings */, 21D741271B21A9A9008A8EB5 /* DiscoverView.xib */, @@ -443,6 +446,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 96157CD01B41AB240022E3F0 /* LoadingIndicator.swift in Sources */, 213997341B3907580027AB55 /* MenuDetailViewController.swift in Sources */, 964690861B3308D800DB187D /* TutorialViewController.swift in Sources */, 21AF14891B0601C800108190 /* Restaurant.swift in Sources */, diff --git a/benri/FirstViewController.swift b/benri/FirstViewController.swift index e3a0063..9f11edf 100644 --- a/benri/FirstViewController.swift +++ b/benri/FirstViewController.swift @@ -75,6 +75,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll var locationService:LocationService = LocationService.sharedInstance var restaurantCache:RestaurantCache = RestaurantCache.sharedInstance var imgCache:ImageCache = ImageCache.sharedInstance + var ldIndicator:LoadingIndicator = LoadingIndicator.sharedInstance let locationManager = CLLocationManager() var populateLength = 5 @@ -113,7 +114,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll NSNotificationCenter.defaultCenter().addObserver(self, selector: "updateNotificationDiscoverSearch", name: discoverSearchNotificationKey, object: nil) self.currentLoadedIndex = 0 - self.populateLength = 5 + self.populateLength = 10 self.menuTableView.delegate = self self.menuTableView.dataSource = self @@ -127,6 +128,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll isInitiated = true self.populateMenu(true, tags: nil, location:locationService.locationToLonLat(locationService.getCurrentLocation())) } + } override func didReceiveMemoryWarning() { @@ -139,7 +141,7 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll static var onceToken : dispatch_once_t = 0 } dispatch_once(&Static.onceToken) { - self.populateMenu(false, tags: nil, location:self.locationService.locationToLonLat(self.locationService.getCurrentLocation())) + self.populateMenu(true, tags: nil, location:self.locationService.locationToLonLat(self.locationService.getCurrentLocation())) } } @@ -167,8 +169,8 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll } if isUserAnswered { locationManager.startUpdatingLocation() - self.initMenu() if !self.isInitiated { + self.initMenu() self.isInitiated = true } } @@ -235,6 +237,8 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll if isReset { dispatch_async(dispatch_get_main_queue()) { self.menuTableView.reloadSections(NSIndexSet(index: 0), withRowAnimation: UITableViewRowAnimation.Bottom) + self.ldIndicator.activityImageView.stopAnimating() + self.ldIndicator.activityImageView.removeFromSuperview() } } else { dispatch_async(dispatch_get_main_queue()) { @@ -257,9 +261,10 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll if isReset { self.currentLoadedIndex = 0 self.menuArray = [] + self.menuTableView.reloadData() + self.ldIndicator.activityImageView.startAnimating() + self.view.addSubview(self.ldIndicator.activityImageView) } - println("location") - println(location) isPopulating = true var menuSVAPI:MenuSVAPI = MenuSVAPI() if let searchTag = tags { @@ -288,6 +293,8 @@ class FirstViewController: UIViewController, CLLocationManagerDelegate, UIScroll if isReset { dispatch_async(dispatch_get_main_queue()) { self.menuTableView.reloadSections(NSIndexSet(index: 0), withRowAnimation: UITableViewRowAnimation.Bottom) + self.ldIndicator.activityImageView.stopAnimating() + self.ldIndicator.activityImageView.removeFromSuperview() } } else { dispatch_async(dispatch_get_main_queue()) { diff --git a/benri/Images.xcassets/Loading/gobblLoading_1.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_1.imageset/Contents.json new file mode 100644 index 0000000..74f1381 --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_1.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_1-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_1-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_1.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_1.imageset/gobblLoading_1-1.png b/benri/Images.xcassets/Loading/gobblLoading_1.imageset/gobblLoading_1-1.png new file mode 100644 index 0000000..5c73281 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_1.imageset/gobblLoading_1-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_1.imageset/gobblLoading_1-2.png b/benri/Images.xcassets/Loading/gobblLoading_1.imageset/gobblLoading_1-2.png new file mode 100644 index 0000000..7701ca8 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_1.imageset/gobblLoading_1-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_1.imageset/gobblLoading_1.png b/benri/Images.xcassets/Loading/gobblLoading_1.imageset/gobblLoading_1.png new file mode 100644 index 0000000..ab0c1a9 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_1.imageset/gobblLoading_1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_10.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_10.imageset/Contents.json new file mode 100644 index 0000000..5c06f9d --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_10.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_19-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_19-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_19.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_10.imageset/gobblLoading_19-1.png b/benri/Images.xcassets/Loading/gobblLoading_10.imageset/gobblLoading_19-1.png new file mode 100644 index 0000000..0d27a7e Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_10.imageset/gobblLoading_19-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_10.imageset/gobblLoading_19-2.png b/benri/Images.xcassets/Loading/gobblLoading_10.imageset/gobblLoading_19-2.png new file mode 100644 index 0000000..0d27a7e Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_10.imageset/gobblLoading_19-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_10.imageset/gobblLoading_19.png b/benri/Images.xcassets/Loading/gobblLoading_10.imageset/gobblLoading_19.png new file mode 100644 index 0000000..b810926 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_10.imageset/gobblLoading_19.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_11.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_11.imageset/Contents.json new file mode 100644 index 0000000..bfd58ed --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_11.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_21-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_21-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_21.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_11.imageset/gobblLoading_21-1.png b/benri/Images.xcassets/Loading/gobblLoading_11.imageset/gobblLoading_21-1.png new file mode 100644 index 0000000..c032536 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_11.imageset/gobblLoading_21-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_11.imageset/gobblLoading_21-2.png b/benri/Images.xcassets/Loading/gobblLoading_11.imageset/gobblLoading_21-2.png new file mode 100644 index 0000000..cd15569 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_11.imageset/gobblLoading_21-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_11.imageset/gobblLoading_21.png b/benri/Images.xcassets/Loading/gobblLoading_11.imageset/gobblLoading_21.png new file mode 100644 index 0000000..75a637b Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_11.imageset/gobblLoading_21.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_12.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_12.imageset/Contents.json new file mode 100644 index 0000000..4e80814 --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_12.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_23-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_23-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_23.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_12.imageset/gobblLoading_23-1.png b/benri/Images.xcassets/Loading/gobblLoading_12.imageset/gobblLoading_23-1.png new file mode 100644 index 0000000..afa65ab Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_12.imageset/gobblLoading_23-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_12.imageset/gobblLoading_23-2.png b/benri/Images.xcassets/Loading/gobblLoading_12.imageset/gobblLoading_23-2.png new file mode 100644 index 0000000..aeae44b Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_12.imageset/gobblLoading_23-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_12.imageset/gobblLoading_23.png b/benri/Images.xcassets/Loading/gobblLoading_12.imageset/gobblLoading_23.png new file mode 100644 index 0000000..de8d2e6 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_12.imageset/gobblLoading_23.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_2.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_2.imageset/Contents.json new file mode 100644 index 0000000..5d82b05 --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_2.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_3-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_3-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_3.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_2.imageset/gobblLoading_3-1.png b/benri/Images.xcassets/Loading/gobblLoading_2.imageset/gobblLoading_3-1.png new file mode 100644 index 0000000..bb0e75d Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_2.imageset/gobblLoading_3-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_2.imageset/gobblLoading_3-2.png b/benri/Images.xcassets/Loading/gobblLoading_2.imageset/gobblLoading_3-2.png new file mode 100644 index 0000000..3746473 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_2.imageset/gobblLoading_3-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_2.imageset/gobblLoading_3.png b/benri/Images.xcassets/Loading/gobblLoading_2.imageset/gobblLoading_3.png new file mode 100644 index 0000000..4d728c3 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_2.imageset/gobblLoading_3.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_3.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_3.imageset/Contents.json new file mode 100644 index 0000000..ee0b351 --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_3.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_5-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_5-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_5.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_3.imageset/gobblLoading_5-1.png b/benri/Images.xcassets/Loading/gobblLoading_3.imageset/gobblLoading_5-1.png new file mode 100644 index 0000000..d835bde Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_3.imageset/gobblLoading_5-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_3.imageset/gobblLoading_5-2.png b/benri/Images.xcassets/Loading/gobblLoading_3.imageset/gobblLoading_5-2.png new file mode 100644 index 0000000..fb6ab98 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_3.imageset/gobblLoading_5-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_3.imageset/gobblLoading_5.png b/benri/Images.xcassets/Loading/gobblLoading_3.imageset/gobblLoading_5.png new file mode 100644 index 0000000..9264d8e Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_3.imageset/gobblLoading_5.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_4.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_4.imageset/Contents.json new file mode 100644 index 0000000..cfc2a6c --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_4.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_7-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_7-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_7.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_4.imageset/gobblLoading_7-1.png b/benri/Images.xcassets/Loading/gobblLoading_4.imageset/gobblLoading_7-1.png new file mode 100644 index 0000000..1d296d6 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_4.imageset/gobblLoading_7-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_4.imageset/gobblLoading_7-2.png b/benri/Images.xcassets/Loading/gobblLoading_4.imageset/gobblLoading_7-2.png new file mode 100644 index 0000000..d459c56 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_4.imageset/gobblLoading_7-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_4.imageset/gobblLoading_7.png b/benri/Images.xcassets/Loading/gobblLoading_4.imageset/gobblLoading_7.png new file mode 100644 index 0000000..33e9869 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_4.imageset/gobblLoading_7.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_5.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_5.imageset/Contents.json new file mode 100644 index 0000000..bdacfd3 --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_5.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_9-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_9-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_9.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_5.imageset/gobblLoading_9-1.png b/benri/Images.xcassets/Loading/gobblLoading_5.imageset/gobblLoading_9-1.png new file mode 100644 index 0000000..fba7441 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_5.imageset/gobblLoading_9-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_5.imageset/gobblLoading_9-2.png b/benri/Images.xcassets/Loading/gobblLoading_5.imageset/gobblLoading_9-2.png new file mode 100644 index 0000000..52191f4 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_5.imageset/gobblLoading_9-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_5.imageset/gobblLoading_9.png b/benri/Images.xcassets/Loading/gobblLoading_5.imageset/gobblLoading_9.png new file mode 100644 index 0000000..f332196 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_5.imageset/gobblLoading_9.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_6.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_6.imageset/Contents.json new file mode 100644 index 0000000..ab1ebb9 --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_6.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_11-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_11-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_11.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_6.imageset/gobblLoading_11-1.png b/benri/Images.xcassets/Loading/gobblLoading_6.imageset/gobblLoading_11-1.png new file mode 100644 index 0000000..19774af Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_6.imageset/gobblLoading_11-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_6.imageset/gobblLoading_11-2.png b/benri/Images.xcassets/Loading/gobblLoading_6.imageset/gobblLoading_11-2.png new file mode 100644 index 0000000..fd5ab13 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_6.imageset/gobblLoading_11-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_6.imageset/gobblLoading_11.png b/benri/Images.xcassets/Loading/gobblLoading_6.imageset/gobblLoading_11.png new file mode 100644 index 0000000..0ee4aed Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_6.imageset/gobblLoading_11.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_7.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_7.imageset/Contents.json new file mode 100644 index 0000000..eab908a --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_7.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_13-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_13-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_13.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_7.imageset/gobblLoading_13-1.png b/benri/Images.xcassets/Loading/gobblLoading_7.imageset/gobblLoading_13-1.png new file mode 100644 index 0000000..94cd03b Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_7.imageset/gobblLoading_13-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_7.imageset/gobblLoading_13-2.png b/benri/Images.xcassets/Loading/gobblLoading_7.imageset/gobblLoading_13-2.png new file mode 100644 index 0000000..7d8298e Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_7.imageset/gobblLoading_13-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_7.imageset/gobblLoading_13.png b/benri/Images.xcassets/Loading/gobblLoading_7.imageset/gobblLoading_13.png new file mode 100644 index 0000000..46a175b Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_7.imageset/gobblLoading_13.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_8.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_8.imageset/Contents.json new file mode 100644 index 0000000..04ea87d --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_8.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_15-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_15-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_15.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_8.imageset/gobblLoading_15-1.png b/benri/Images.xcassets/Loading/gobblLoading_8.imageset/gobblLoading_15-1.png new file mode 100644 index 0000000..9777c2e Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_8.imageset/gobblLoading_15-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_8.imageset/gobblLoading_15-2.png b/benri/Images.xcassets/Loading/gobblLoading_8.imageset/gobblLoading_15-2.png new file mode 100644 index 0000000..3a952fc Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_8.imageset/gobblLoading_15-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_8.imageset/gobblLoading_15.png b/benri/Images.xcassets/Loading/gobblLoading_8.imageset/gobblLoading_15.png new file mode 100644 index 0000000..173c968 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_8.imageset/gobblLoading_15.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_9.imageset/Contents.json b/benri/Images.xcassets/Loading/gobblLoading_9.imageset/Contents.json new file mode 100644 index 0000000..663a108 --- /dev/null +++ b/benri/Images.xcassets/Loading/gobblLoading_9.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gobblLoading_17-2.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "gobblLoading_17-1.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "gobblLoading_17.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/benri/Images.xcassets/Loading/gobblLoading_9.imageset/gobblLoading_17-1.png b/benri/Images.xcassets/Loading/gobblLoading_9.imageset/gobblLoading_17-1.png new file mode 100644 index 0000000..0161c01 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_9.imageset/gobblLoading_17-1.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_9.imageset/gobblLoading_17-2.png b/benri/Images.xcassets/Loading/gobblLoading_9.imageset/gobblLoading_17-2.png new file mode 100644 index 0000000..6b067d1 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_9.imageset/gobblLoading_17-2.png differ diff --git a/benri/Images.xcassets/Loading/gobblLoading_9.imageset/gobblLoading_17.png b/benri/Images.xcassets/Loading/gobblLoading_9.imageset/gobblLoading_17.png new file mode 100644 index 0000000..dbb6df4 Binary files /dev/null and b/benri/Images.xcassets/Loading/gobblLoading_9.imageset/gobblLoading_17.png differ diff --git a/benri/LoadingIndicator.swift b/benri/LoadingIndicator.swift new file mode 100644 index 0000000..0b13f62 --- /dev/null +++ b/benri/LoadingIndicator.swift @@ -0,0 +1,91 @@ +// +// LoadingIndicator.swift +// +// +// Created by Kittikorn Ariyasuk on 6/30/15. +// +// + +import Foundation + +class LoadingIndicator { + + let imageFile = ["gobblLoading_1","gobblLoading_2","gobblLoading_3","gobblLoading_4","gobblLoading_5","gobblLoading_6","gobblLoading_7","gobblLoading_8","gobblLoading_9","gobblLoading_10","gobblLoading_11","gobblLoading_12"] + + var statusImage:UIImage! + var activityImageView:UIImageView! + + init() { + statusImage = UIImage(named: "gobblLoading_1") + activityImageView = UIImageView(image: statusImage) + var animationImages:[UIImage] = [] + for imageNamed in imageFile { + if let img = UIImage(named: imageNamed) { + animationImages.append(img) + } + } + + activityImageView.animationImages = animationImages + + + println(activityImageView.animationImages) + activityImageView.animationDuration = 0.8 + + var bounds = UIScreen.mainScreen().bounds + var width = bounds.size.width + var height = bounds.size.height + activityImageView.frame = CGRectMake((width / 2) - (statusImage.size.width / 2), (height/2)-(statusImage.size.height/2), statusImage.size.width, statusImage.size.height) + + /* + CGRectMake(self.view.frame.size.width/2 + -statusImage.size.width/2, + self.view.frame.size.height/2 + -statusImage.size.height/2, + statusImage.size.width, + statusImage.size.height);*/ + + } + + /*UIImageView *activityImageView = [[UIImageView alloc] + initWithImage:statusImage]; + + + //Add more images which will be used for the animation + activityImageView.animationImages = [NSArray arrayWithObjects: + [UIImage imageNamed:@"status1.png"], + [UIImage imageNamed:@"status2.png"], + [UIImage imageNamed:@"status3.png"], + [UIImage imageNamed:@"status4.png"], + [UIImage imageNamed:@"status5.png"], + [UIImage imageNamed:@"status6.png"], + [UIImage imageNamed:@"status7.png"], + [UIImage imageNamed:@"status8.png"], + nil]; + */ + + //Set the duration of the animation (play with it + //until it looks nice for you) + + + + //Start the animation + //[activityImageView startAnimating]; + + + //Add your custom activity indicator to your current view + //[self.view addSubview:activityImageView]; + + func animate() { + + } + class var sharedInstance : LoadingIndicator { + struct Static { + static var onceToken : dispatch_once_t = 0 + static var instance : LoadingIndicator? = nil + } + dispatch_once(&Static.onceToken) { + Static.instance = LoadingIndicator() + } + return Static.instance! + } +} \ No newline at end of file