Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shijinliang committed Dec 24, 2015
1 parent 8ed653f commit b102f87
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 4 deletions.
2 changes: 2 additions & 0 deletions KSOpenQQ.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = KSOpenQQ/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.kamy.test.KSOpenQQ;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -275,6 +276,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = KSOpenQQ/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.kamy.test.KSOpenQQ;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
44 changes: 41 additions & 3 deletions KSOpenQQ/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,25 +1,63 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="14F1505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="line" placeholder="请输入你想联系的QQ" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="KTj-b6-OIq">
<rect key="frame" x="200" y="285" width="200" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="200" id="7bv-p0-0TT"/>
<constraint firstAttribute="height" constant="30" id="frS-pg-z6O"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" keyboardType="numberPad"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hDt-5X-WMw">
<rect key="frame" x="260" y="335" width="80" height="30"/>
<color key="backgroundColor" red="0.98431372549999996" green="0.61176470589999998" blue="0.039215686270000001" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="lik-eB-9o1"/>
</constraints>
<state key="normal" title="点击聊天"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="10"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="openQQChat:" destination="BYZ-38-t0r" eventType="touchUpInside" id="AOu-Pg-5bh"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="hDt-5X-WMw" firstAttribute="top" secondItem="KTj-b6-OIq" secondAttribute="bottom" constant="20" id="WBN-Bf-7Oo"/>
<constraint firstItem="KTj-b6-OIq" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="akn-Wx-kDQ"/>
<constraint firstItem="hDt-5X-WMw" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="iGu-gk-mH3"/>
<constraint firstItem="KTj-b6-OIq" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="py7-Ta-SRm"/>
</constraints>
</view>
<connections>
<outlet property="qqNumText" destination="KTj-b6-OIq" id="WhP-5V-QNg"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="245" y="302"/>
</scene>
</scenes>
</document>
18 changes: 17 additions & 1 deletion KSOpenQQ/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,36 @@

#import "ViewController.h"

@interface ViewController ()
@interface ViewController ()<UIWebViewDelegate>
@property (weak, nonatomic) IBOutlet UITextField *qqNumText;

@property (nonatomic, strong) UIWebView *webView;
@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.webView = [[UIWebView alloc] initWithFrame:CGRectZero];
[self.view addSubview:self.webView];
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)openQQChat:(UIButton *)sender {
if (self.qqNumText.text.length == 0) {
return;
}
//拼写打开QQ 的URL
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"mqq://im/chat?chat_type=wpa&uin=%@&version=1&src_type=web",self.qqNumText.text]];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
self.webView.delegate = self;
[self.webView loadRequest:request];

[self.view endEditing:YES];
}

@end

0 comments on commit b102f87

Please sign in to comment.