Skip to content

Commit

Permalink
Open Links in Safari from buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
MengTo committed Dec 20, 2013
1 parent c98a5d7 commit 7ba2e52
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
Binary file not shown.
20 changes: 20 additions & 0 deletions Ripple/Base.lproj/Main.storyboard
Expand Up @@ -271,6 +271,16 @@
<userDefinedRuntimeAttribute type="string" keyPath="fontName" value="MuseoSans-300"/>
</userDefinedRuntimeAttributes>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uEH-9v-UDj">
<rect key="frame" x="0.0" y="0.0" width="310" height="48"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="twitterDidPress:" destination="zcD-cf-5IO" eventType="touchUpInside" id="tzX-ZX-isK"/>
</connections>
</button>
<imageView userInteractionEnabled="NO" alpha="0.75" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="icon-twitter" translatesAutoresizingMaskIntoConstraints="NO" id="AAy-K0-CEv">
<rect key="frame" x="15" y="9" width="29" height="29"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
Expand Down Expand Up @@ -324,6 +334,16 @@
<rect key="frame" x="60" y="47" width="245" height="1"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PWa-Vu-Klo">
<rect key="frame" x="0.0" y="0.0" width="310" height="48"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="facebookDidPress:" destination="zcD-cf-5IO" eventType="touchUpInside" id="Haj-7B-cfl"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
Expand Down
2 changes: 2 additions & 0 deletions Ripple/ProfileViewController.h
Expand Up @@ -9,5 +9,7 @@
#import <UIKit/UIKit.h>

@interface ProfileViewController : UIViewController
- (IBAction)facebookDidPress:(id)sender;
- (IBAction)twitterDidPress:(id)sender;

@end
10 changes: 10 additions & 0 deletions Ripple/ProfileViewController.m
Expand Up @@ -32,4 +32,14 @@ -(UIStatusBarStyle)preferredStatusBarStyle{
return UIStatusBarStyleLightContent;
}

- (IBAction)facebookDidPress:(id)sender {
NSString *link = [NSString stringWithFormat:@"http://facebook.com/mengto"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: link]];
}

- (IBAction)twitterDidPress:(id)sender {
NSString *link = [NSString stringWithFormat:@"http://twitter.com/mengto"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: link]];
}

@end

0 comments on commit 7ba2e52

Please sign in to comment.