Browse Source

全局相关函数 方法 字符串

hxb 9 years ago
parent
commit
abf44920cc

+ 37 - 0
Global.swift

@@ -0,0 +1,37 @@
+//
+//  Global.swift
+//  SocketChat
+//
+//  Created by Justine on 16/6/16.
+//  Copyright © 2016年 AppCoda. All rights reserved.
+//
+
+import Foundation
+
+/**
+ 注销登录
+ */
+func logout(){
+    print("logout 被调用")
+    //退出返回到登录界面 需要释放的资源
+        //1全局变量TCPClient,服务器各项IP
+        //
+}
+
+/**
+ 更新版本
+ */
+func updateVersion(){
+    //从指定网址读取json 比对版本号
+}
+
+
+
+/**
+ *  通知中心相关
+ *      icon角标
+ *      网络连接状态
+ *      消息接收(不含通知)
+ *      消息发送
+ */
+

+ 4 - 0
SocketChat.xcodeproj/project.pbxproj

@@ -252,6 +252,7 @@
 		D1889A961CF43E2D00160217 /* LoginMsg.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1889A951CF43E2D00160217 /* LoginMsg.swift */; };
 		D1C7D77C1D0C82F600AB6AE2 /* zhuxun.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = D1C7D77A1D0C82F600AB6AE2 /* zhuxun.xcdatamodeld */; };
 		D1CB81431D127864000C4CF6 /* RecentViewController1.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1CB81421D127864000C4CF6 /* RecentViewController1.swift */; };
+		D1CB81451D12804D000C4CF6 /* Global.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1CB81441D12804D000C4CF6 /* Global.swift */; };
 		D1FC83121CFE828C003318E4 /* MyAlertViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1FC83111CFE828C003318E4 /* MyAlertViewController.swift */; };
 /* End PBXBuildFile section */
 
@@ -505,6 +506,7 @@
 		D1889A951CF43E2D00160217 /* LoginMsg.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginMsg.swift; sourceTree = "<group>"; };
 		D1C7D77B1D0C82F600AB6AE2 /* zhuxun.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = zhuxun.xcdatamodel; sourceTree = "<group>"; };
 		D1CB81421D127864000C4CF6 /* RecentViewController1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentViewController1.swift; sourceTree = "<group>"; };
+		D1CB81441D12804D000C4CF6 /* Global.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Global.swift; sourceTree = "<group>"; };
 		D1FC83111CFE828C003318E4 /* MyAlertViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyAlertViewController.swift; sourceTree = "<group>"; };
 		D258BF5883AA9D6A5B402A92 /* Pods-SocketChat.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SocketChat.release.xcconfig"; path = "Pods/Target Support Files/Pods-SocketChat/Pods-SocketChat.release.xcconfig"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
@@ -947,6 +949,7 @@
 				D13BE3171CEF098A003EED36 /* func.swift */,
 				D14188D21CF3E55E00DD43D0 /* ManagerUserDefault.swift */,
 				D1FC83111CFE828C003318E4 /* MyAlertViewController.swift */,
+				D1CB81441D12804D000C4CF6 /* Global.swift */,
 			);
 			name = ToolClass;
 			path = ..;
@@ -1347,6 +1350,7 @@
 				D120FAF81CF7EA3400BB4737 /* SettingViewController.swift in Sources */,
 				D12D9F9E1CFBF9630089B514 /* LoginRet.swift in Sources */,
 				D12D9FA01CFBF9630089B514 /* LoginRetDevice.swift in Sources */,
+				D1CB81451D12804D000C4CF6 /* Global.swift in Sources */,
 				D1800D921CFD36D3009C5ABB /* SMSViewController.swift in Sources */,
 				D1C7D77C1D0C82F600AB6AE2 /* zhuxun.xcdatamodeld in Sources */,
 				D12D9F951CFBE6C80089B514 /* RootViewController.swift in Sources */,

BIN
SocketChat.xcworkspace/xcuserdata/justine.xcuserdatad/UserInterfaceState.xcuserstate


+ 4 - 4
SocketChat.xcworkspace/xcuserdata/justine.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -22,7 +22,7 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "SocketChat/SMSViewController.swift"
@@ -70,7 +70,7 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "SocketChat/RecentViewController1.swift"
@@ -86,7 +86,7 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "SocketChat/RecentViewController1.swift"
@@ -102,7 +102,7 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "SocketChat/RecentViewController1.swift"

+ 106 - 14
SocketChat/Base.lproj/Main.storyboard

@@ -437,21 +437,86 @@
         <!--设置-->
         <scene sceneID="x22-iM-009">
             <objects>
-                <tableViewController storyboardIdentifier="SettingView" title="设置" useStoryboardIdentifierAsRestorationIdentifier="YES" id="MCr-AC-A54" sceneMemberID="viewController">
-                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="GvL-EB-6tK">
+                <tableViewController storyboardIdentifier="SettingView" title="设置" useStoryboardIdentifierAsRestorationIdentifier="YES" id="MCr-AC-A54" customClass="SettingViewController" customModule="SocketChat" customModuleProvider="target" sceneMemberID="viewController">
+                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="GvL-EB-6tK">
                         <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                        <prototypes>
-                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="av1-lJ-dgu">
-                                <rect key="frame" x="0.0" y="92" width="600" height="44"/>
-                                <autoresizingMask key="autoresizingMask"/>
-                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="av1-lJ-dgu" id="43k-hL-Sd0">
-                                    <rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
-                                    <autoresizingMask key="autoresizingMask"/>
-                                </tableViewCellContentView>
-                            </tableViewCell>
-                        </prototypes>
+                        <sections>
+                            <tableViewSection headerTitle="Section-1" id="krx-vh-PA7">
+                                <cells>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="av1-lJ-dgu">
+                                        <rect key="frame" x="0.0" y="92" width="600" height="44"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="av1-lJ-dgu" id="43k-hL-Sd0">
+                                            <rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </tableViewCellContentView>
+                                    </tableViewCell>
+                                </cells>
+                            </tableViewSection>
+                            <tableViewSection headerTitle="Section-2" id="Ahu-pO-jTW">
+                                <cells>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="cW1-vI-lgP">
+                                        <rect key="frame" x="0.0" y="164" width="600" height="44"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="cW1-vI-lgP" id="GY6-eG-kpu">
+                                            <rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </tableViewCellContentView>
+                                    </tableViewCell>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="tZ1-os-2ND">
+                                        <rect key="frame" x="0.0" y="208" width="600" height="44"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="tZ1-os-2ND" id="zAD-44-uYf">
+                                            <rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </tableViewCellContentView>
+                                    </tableViewCell>
+                                </cells>
+                            </tableViewSection>
+                            <tableViewSection headerTitle="Section-3" id="uZD-Qj-5fZ">
+                                <cells>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="pAf-Lz-1OC">
+                                        <rect key="frame" x="0.0" y="280" width="600" height="44"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="pAf-Lz-1OC" id="fvO-e5-6Dj">
+                                            <rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </tableViewCellContentView>
+                                    </tableViewCell>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="jYE-Xo-Uf4">
+                                        <rect key="frame" x="0.0" y="324" width="600" height="44"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="jYE-Xo-Uf4" id="d8e-vv-ir6">
+                                            <rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                        </tableViewCellContentView>
+                                    </tableViewCell>
+                                </cells>
+                            </tableViewSection>
+                            <tableViewSection headerTitle="Section-4" id="ID1-aZ-i0w">
+                                <cells>
+                                    <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="FM8-F3-BQ8">
+                                        <rect key="frame" x="0.0" y="396" width="600" height="44"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                        <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="FM8-F3-BQ8" id="Oax-0V-LGk">
+                                            <rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
+                                            <autoresizingMask key="autoresizingMask"/>
+                                            <subviews>
+                                                <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KIU-Iv-yig">
+                                                    <rect key="frame" x="0.0" y="-8" width="600" height="52"/>
+                                                    <state key="normal" title="注销登录"/>
+                                                    <connections>
+                                                        <action selector="btnLogOut:" destination="MCr-AC-A54" eventType="touchUpInside" id="2qJ-Cp-kEg"/>
+                                                    </connections>
+                                                </button>
+                                            </subviews>
+                                        </tableViewCellContentView>
+                                    </tableViewCell>
+                                </cells>
+                            </tableViewSection>
+                        </sections>
                         <connections>
                             <outlet property="dataSource" destination="MCr-AC-A54" id="Qua-GS-XwS"/>
                             <outlet property="delegate" destination="MCr-AC-A54" id="Ia9-dv-ejn"/>
@@ -539,6 +604,33 @@
             </objects>
             <point key="canvasLocation" x="1780" y="1357"/>
         </scene>
+        <!--Table View Controller-->
+        <scene sceneID="CJ2-tH-VHu">
+            <objects>
+                <tableViewController id="Xis-Bw-fbU" sceneMemberID="viewController">
+                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="u4M-bW-n6W">
+                        <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        <prototypes>
+                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="g0O-gH-ArG">
+                                <rect key="frame" x="0.0" y="28" width="600" height="44"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="g0O-gH-ArG" id="5tz-Jc-HaC">
+                                    <rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
+                                    <autoresizingMask key="autoresizingMask"/>
+                                </tableViewCellContentView>
+                            </tableViewCell>
+                        </prototypes>
+                        <connections>
+                            <outlet property="dataSource" destination="Xis-Bw-fbU" id="oc7-dy-YkJ"/>
+                            <outlet property="delegate" destination="Xis-Bw-fbU" id="agT-cN-PjY"/>
+                        </connections>
+                    </tableView>
+                </tableViewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="Ee8-Oh-Nvd" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+        </scene>
     </scenes>
     <resources>
         <image name="contact_icon.png" width="30" height="30"/>
@@ -552,7 +644,7 @@
         <image name="setting_icon.png" width="30" height="30"/>
     </resources>
     <inferredMetricsTieBreakers>
-        <segue reference="mey-Yu-0rI"/>
-        <segue reference="yIj-Qz-Fki"/>
+        <segue reference="Ew8-dJ-QX2"/>
+        <segue reference="YJE-Mf-7te"/>
     </inferredMetricsTieBreakers>
 </document>

+ 9 - 7
SocketChat/RecentViewController1.swift

@@ -12,7 +12,7 @@ class RecentViewController1: UITableViewController {
     var dataList = NSMutableArray()
     override func viewDidLoad() {
         super.viewDidLoad()
-
+        
         // Uncomment the following line to preserve selection between presentations
         // self.clearsSelectionOnViewWillAppear = false
 
@@ -38,13 +38,15 @@ class RecentViewController1: UITableViewController {
         mysocket?.send("user.auth", data: params)
         TCPClient.shareInstance.recived("user.auth")
 
-        
-        
-        
-        
-        
+   
     }
-
+    
+    func regNotification() {
+        NSNotificationCenter.defaultCenter().addObserverForName(<#T##name: String?##String?#>, object: <#T##AnyObject?#>, queue: <#T##NSOperationQueue?#>, usingBlock: <#T##(NSNotification) -> Void#>)
+    }
+    
+    
+    
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
         // Dispose of any resources that can be recreated.

+ 24 - 14
SocketChat/SettingViewController.swift

@@ -8,12 +8,19 @@
 
 import UIKit
 
-class SettingViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
-    var tableView:UITableView?
+class SettingViewController: UITableViewController {
+
+    @IBAction func btnLogOut(sender: UIButton) {
+        logout()
+        
+    }
+
     var dataList = NSMutableArray()
     override func viewDidLoad() {
         super.viewDidLoad()
+        
         self.view.backgroundColor = UIColor.blueColor()
+        
         // Do any additional setup after loading the view.
         self.tableView?.dataSource = self
         self.tableView?.delegate = self
@@ -35,18 +42,21 @@ class SettingViewController: UIViewController,UITableViewDelegate,UITableViewDat
     }
     */
     //实现继承的委托中的两个方法
-    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
-        return 100;
-    }
     
-    //返回Cell
-    func tableView(tableView:UITableView, cellForRowAtIndexPath indexPath:NSIndexPath)->UITableViewCell{
-        //根据需求自己重绘
-        let cell = UITableViewCell(style: .Default, reuseIdentifier: "cell")
-        //        let cellID="Cell ID";
-        //        var cell=tableView.dequeueReusableCellWithIdentifier(cellID) as? UITableViewCell;
-        //
-        return cell;
-    }
+    
+//    //静态的
+//    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
+//        return 100;
+//    }
+//    
+//    //返回Cell  静态的
+//    override func tableView(tableView:UITableView, cellForRowAtIndexPath indexPath:NSIndexPath)->UITableViewCell{
+//        //根据需求自己重绘
+//        let cell = UITableViewCell(style: .Default, reuseIdentifier: "cell")
+//        //        let cellID="Cell ID";
+//        //        var cell=tableView.dequeueReusableCellWithIdentifier(cellID) as? UITableViewCell;
+//        //
+//        return cell;
+//    }
 
 }