Permalink
Browse files

COntinuing to implement bookmark/history views, more tweaks to popout…

… in webview
  • Loading branch information...
1 parent 689a704 commit b552300c85514cb90a3430f6c9ae61637f8c1d94 @xirianlight xirianlight committed Mar 20, 2013
@@ -10,6 +10,7 @@
6B2D7B2A16F8FE2B00E6D3A5 /* Photo.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B2D7B2916F8FE2B00E6D3A5 /* Photo.m */; };
6B2D7B2D16F8FE2B00E6D3A5 /* Business.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B2D7B2C16F8FE2B00E6D3A5 /* Business.m */; };
830729D416F766D6000F0037 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 830729D216F766D6000F0037 /* Model.xcdatamodeld */; };
+ 83235E2C16FA27F80066659B /* webViewPopOut@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83235E2B16FA27F80066659B /* webViewPopOut@2x.png */; };
83332D2316F90F460085BDB6 /* wifiIcon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83332D2216F90F460085BDB6 /* wifiIcon@2x.png */; };
8335571616F6D27600DB17D5 /* YelpWebPageBrowser.m in Sources */ = {isa = PBXBuildFile; fileRef = 8335571516F6D27600DB17D5 /* YelpWebPageBrowser.m */; };
8335571916F754C800DB17D5 /* xmark.png in Resources */ = {isa = PBXBuildFile; fileRef = 8335571816F754C800DB17D5 /* xmark.png */; };
@@ -72,6 +73,7 @@
6B2D7B2B16F8FE2B00E6D3A5 /* Business.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Business.h; path = ../Business.h; sourceTree = "<group>"; };
6B2D7B2C16F8FE2B00E6D3A5 /* Business.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Business.m; path = ../Business.m; sourceTree = "<group>"; };
830729D316F766D6000F0037 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
+ 83235E2B16FA27F80066659B /* webViewPopOut@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "webViewPopOut@2x.png"; sourceTree = "<group>"; };
83332D2216F90F460085BDB6 /* wifiIcon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "wifiIcon@2x.png"; sourceTree = "<group>"; };
8335571416F6D27600DB17D5 /* YelpWebPageBrowser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YelpWebPageBrowser.h; sourceTree = "<group>"; };
8335571516F6D27600DB17D5 /* YelpWebPageBrowser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YelpWebPageBrowser.m; sourceTree = "<group>"; };
@@ -274,6 +276,7 @@
8F3AD83816F90A0300BEEB3A /* Custom Images */ = {
isa = PBXGroup;
children = (
+ 83235E2B16FA27F80066659B /* webViewPopOut@2x.png */,
83BB6B6D16FA0A64003A4506 /* circleMask6464@2x.png */,
83BB6B6A16FA0A31003A4506 /* circleMask6464.png */,
83332D2216F90F460085BDB6 /* wifiIcon@2x.png */,
@@ -388,6 +391,7 @@
83332D2316F90F460085BDB6 /* wifiIcon@2x.png in Resources */,
83BB6B6B16FA0A31003A4506 /* circleMask6464.png in Resources */,
83BB6B6E16FA0A64003A4506 /* circleMask6464@2x.png in Resources */,
+ 83235E2C16FA27F80066659B /* webViewPopOut@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
+#import "Venue.h"
@interface BookmarksViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
@@ -29,9 +29,39 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- (void)viewDidLoad
{
[super viewDidLoad];
+//Add title field to navigation bar
+
+
+ //self.navigationItem.title = [[UIBarButtonItem alloc] init];
+
+ self.navigationItem.title = @"Bookmarks";
+
+ //Working code starst here - placemarker array
testBookmarks = [[NSArray alloc] initWithObjects:@"First Bookmark", @"Second Bookmark", @"Third Bookmark", nil];
}
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
+ // Return YES if you want the specified item to be editable.
+ return YES;
+}
+
+// Override to support editing the table view.
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+ if (editingStyle == UITableViewCellEditingStyleDelete) {
+ // [self removeBookmarkStatusFrom:<#(Venue *)#>];
+ }
+}
+
+//Remove from bookmarks, but do not remove from history.
+-(void)removeBookmarkStatusFrom: (Venue*)venue
+{
+ //venue.isBookmarked = NO;
+ NSError *error;
+ //if (![self.myManagedObjectContext save:&error])
+ {
+ NSLog(@"Add bookmark status failed.");
+ }
+}
#pragma mark -- table methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
@@ -65,7 +95,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
- [self performSegueWithIdentifier:@"bookmarkToWebView" sender:self];
+// [self performSegueWithIdentifier:@"bookmarkToWebView" sender:self];
[tableView deselectRowAtIndexPath: indexPath animated:YES];
}
@@ -272,6 +272,8 @@ -(IBAction) backToFlickrMapView: (UIStoryboardSegue *)segue
-(void) bookmarkButtonPressed
{
NSLog(@"User pressed button to go to bookmarks");
+ [self performSegueWithIdentifier: @"toBookmarksAndHistory" sender:self];
+
}
# pragma mark - End of document
@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
+#import "Venue.h"
@interface HistoryViewController : UIViewController <UITableViewDelegate, UITableViewDataSource>
@@ -29,6 +29,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- (void)viewDidLoad
{
[super viewDidLoad];
+ self.title = @"History";
testHistory = [[NSArray alloc] initWithObjects:@"History 1", @"History 2", @"History 3", nil];
}
@@ -73,9 +74,39 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
+ // Return YES if you want the specified item to be editable.
+ return YES;
+}
+// Override to support editing the table view.
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+ if (editingStyle == UITableViewCellEditingStyleDelete) {
+ //The following occurs when you swipe to delete and hit delete.
+ //[self deleteVenue:(Venue*)];
+
+ //From vokal spies project, to delete on swipe...
+// Person * person = [displaySpies objectAtIndex:indexPath.row];
+// [self deletePerson:person];
+//
+// displaySpies = [self getCurrentSpies];
+//
+// [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
+//
+// [tableView reloadData];
+ }
+}
-
+//Delete an object from the History.
+-(void)deleteVenue: (Venue*)venue
+{
+// [self.myManagedObjectContext deleteObject:venue];
+ NSError *error;
+// if (![self.myManagedObjectContext save:&error])
+ {
+ NSLog(@"Delete History item method failed.");
+ }
+}
@@ -50,6 +50,9 @@ myAnnotation.image = maskedAnnotationImage;
------------------------------------------------------------------------
Fetch requests for bookmarks and history
+To manually call a segue, add this method to bookmarkButtonPressed method
+[self performSegueWithIdentifier: @”toBookmarksAndHistory” sender:self]
+
//Do we need to instantiate our lists before we begin?
MMAppDelegate *mmAppDelegate = (MMAppDelegate*)[[UIApplication sharedApplication] delegate];
self.myManagedObjectContext = mmAppDelegate.managedObjectContext;
@@ -131,7 +134,7 @@ freak = [NSEntityDescription insertNewObjectForEntityForName: @"Freak" inManaged
}
}
-//Remove from bookmarks, but do not remove from history.
+//Add to bookmarks.
-(void)addBookmarkStatusFrom: (Venue*)venue
{
venue.isBookmarked = YES;
@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
+#import "Venue.h"
@interface YelpWebPageBrowser : UIViewController <UIWebViewDelegate>
@@ -52,34 +52,57 @@ - (void)viewDidLoad
//Scroll off "swipe to navigate" message after 1.5 seconds
//Hold for 1.5 seconds, then scroll off left side.
- [UIView animateWithDuration:1.5 animations:^(void)
- {popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y);}
+// [UIView animateWithDuration:1.0 animations:^(void)
+// {popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y-10);}
+// completion:^(BOOL finished){
+// [UIView animateWithDuration:2.5 animations:
+// ^{popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y+200);
+// popoutView.alpha = 0;
+// }
+// ];
+// }
+// ];
+
+ [UIView animateWithDuration:0.75
+ delay:1.0
+ options: UIViewAnimationCurveEaseIn
+ animations:^{
+ popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y+200);
+ popoutView.alpha = 0;
+ }
completion:^(BOOL finished){
- [UIView animateWithDuration:0.5 animations:
- ^{popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y-100);}
- ];
- }
- ];
-
+ NSLog(@"Done!");
+ }];
+
+
+
+
+ //End of method bracket
}
+
+
-(void) addBookmark
{
//Include code here that will add the current Yelp business as a bookmark
//Come back to this once Core Data implementation is complete.
-
+ //Method call to add bookmark status to a provided venue
+ //[self addBookmarkStatusTo:(Venue *)];
//Tell user that bookmark has been added
popoutViewTextLabel.text = @"Bookmark added";
//Scroll on, pause for 1.5 seconds, scroll off
[UIView animateWithDuration:0.5 animations:^(void)
- {popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y+100);}
+ {popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y-201);
+ popoutView.alpha = 0.75;}
completion:^(BOOL finished){
- [UIView animateWithDuration:1.5 animations:^(void)
- {popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y);}
+ [UIView animateWithDuration:0.75 animations:^(void)
+ {popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y);
+ popoutView.alpha = 1;}
completion:^(BOOL finished){
[UIView animateWithDuration:0.5 animations:
- ^{popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y-100);}
+ ^{popoutView.center = CGPointMake(popoutView.center.x, popoutView.center.y+200);
+ popoutView.alpha = 0;}
];
}
]; }
@@ -89,6 +112,16 @@ -(void) addBookmark
}
+//Add to bookmarks.
+-(void)addBookmarkStatusTo: (Venue*)venue
+{
+ //venue.isBookmarked = YES;
+ NSError *error;
+ //if (![self.myManagedObjectContext save:&error])
+ {
+ NSLog(@"Add bookmark status failed.");
+ }
+}
- (void)didReceiveMemoryWarning
{
@@ -78,34 +78,23 @@
<outletCollection property="gestureRecognizers" destination="aMq-dz-sRv" appends="YES" id="mHB-oi-SQu"/>
</connections>
</webView>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" id="v2A-LT-eS2">
- <rect key="frame" x="288" y="472" width="32" height="32"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
- <fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
- <state key="normal" title="Back" image="xmark.png">
- <color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
- <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
- </state>
- <state key="highlighted">
- <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
- </state>
- <connections>
- <segue destination="5YE-ke-7F9" kind="unwind" unwindAction="backToYelpMapView:" id="feb-hB-Kev"/>
- </connections>
- </button>
<view contentMode="scaleToFill" id="JIq-gF-FaR">
- <rect key="frame" x="0.0" y="382" width="320" height="47"/>
+ <rect key="frame" x="0.0" y="408" width="320" height="47"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Swipe to go forward or back" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="emB-3U-nsG">
- <rect key="frame" x="55" y="13" width="211" height="21"/>
+ <imageView userInteractionEnabled="NO" alpha="0.75" contentMode="scaleToFill" image="webViewPopOut@2x.png" id="07p-dX-8kh">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="47"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ </imageView>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Swipe to go forward or back" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="emB-3U-nsG">
+ <rect key="frame" x="20" y="13" width="280" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -118,7 +107,6 @@
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="UfP-Tc-Lc4" userLabel="First Responder" sceneMemberID="firstResponder"/>
- <exit id="5YE-ke-7F9" userLabel="Exit" sceneMemberID="exit"/>
<swipeGestureRecognizer direction="right" id="wLz-no-EhL">
<connections>
<action selector="swipeRightAction:" destination="qVE-kj-ncM" id="Qha-LN-PxN"/>
@@ -264,12 +252,12 @@
</objects>
<point key="canvasLocation" x="768" y="734"/>
</scene>
- <!--Tab Bar Controller-->
+ <!--Tab Bar Controller - Bookmarks-->
<scene sceneID="oO3-Hi-Sd7">
<objects>
<tabBarController definesPresentationContext="YES" id="jTz-JW-Bre" sceneMemberID="viewController">
- <navigationItem key="navigationItem" id="tTS-da-KVz"/>
- <simulatedTabBarMetrics key="simulatedBottomBarMetrics"/>
+ <navigationItem key="navigationItem" title="Bookmarks" id="tTS-da-KVz"/>
+ <nil key="simulatedBottomBarMetrics"/>
<tabBar key="tabBar" contentMode="scaleToFill" id="vFv-sq-U5G">
<rect key="frame" x="129" y="330" width="163" height="49"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
@@ -286,7 +274,7 @@
</scene>
</scenes>
<resources>
- <image name="xmark.png" width="64" height="64"/>
+ <image name="webViewPopOut@2x.png" width="640" height="94"/>
</resources>
<classes>
<class className="BookmarksViewController" superclassName="UIViewController">
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b552300

Please sign in to comment.