Skip to content

Commit

Permalink
add viper mudule
Browse files Browse the repository at this point in the history
  • Loading branch information
caonongyun authored and caonongyun committed Apr 19, 2017
1 parent 3b6c5f2 commit 52b1df9
Show file tree
Hide file tree
Showing 92 changed files with 3,977 additions and 234 deletions.
Binary file modified .DS_Store
Binary file not shown.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

**采用Swift语言,仿追书神器做的,主要是练习阅读器的一些技术,包括仿真阅读等。不断更新中......**

**仅供学习交流,严禁用于商业用途**
**仅供学习交流,请勿用于商业用途**

## Requirements

Expand All @@ -22,6 +22,13 @@ Main development of TXTReader olny support Swift 3.0+.

=======

###效果图如下:

![zhuishushenqi](zhuishushenqi.png)
![zhuishenqiimg](qs_reader.png)
![zhuishenqiimg](qs_readerMain.png)
![zhuishenqiimg](qs_changeSource.png)


## Contact

Expand Down
Binary file added qs_changeSource.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added qs_reader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added qs_readerMain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
200 changes: 182 additions & 18 deletions zhuishushenqi.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions zhuishushenqi/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
UIScreen.main.brightness = 0.5

}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
UIScreen.main.brightness = 0.5
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
UIScreen.main.brightness = getBrightness()
}

func applicationDidBecomeActive(_ application: UIApplication) {
Expand Down
21 changes: 21 additions & 0 deletions zhuishushenqi/Assets.xcassets/loadside.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions zhuishushenqi/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C68" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -14,9 +18,9 @@
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<nil key="simulatedStatusBarMetrics"/>
</viewController>
Expand Down
88 changes: 88 additions & 0 deletions zhuishushenqi/Base/Views/QSLoadingView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//
// QSLoadingView.swift
// zhuishushenqi
//
// Created by caonongyun on 2017/4/13.
// Copyright © 2017年 QS. All rights reserved.
//

import UIKit

typealias CloseAction = ()->Void

class QSLoadingView: UIView {

var tipStr:String? {
didSet{
tip.text = tipStr
}
}
var tip:UILabel!
var closeClosure:CloseAction?

override init(frame: CGRect) {
super.init(frame: frame)
setupSubviews()
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func setupSubviews(){
self.backgroundColor = UIColor.clear
let bgView = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
bgView.backgroundColor = UIColor(red: 1/255.0, green: 1/255.0, blue: 1/255.0, alpha: 0.8)
bgView.center = self.center
let loadView = UIImageView(frame: CGRect(x: 0, y: 0, width: 30, height: 30))
loadView.center = CGPoint(x: bgView.bounds.width/2, y: bgView.bounds.height/2 - 10)
loadView.image = UIImage(named: "loadside")
bgView.addSubview(loadView)
bgView.layer.cornerRadius = 10
addSubview(bgView)
tip = UILabel(frame: CGRect(x: 0, y: bgView.bounds.height - 30, width: 100, height: 20))
tip.font = UIFont.systemFont(ofSize: 11)
tip.textColor = UIColor.white
tip.textAlignment = .center
tip.text = "正在加载..."
bgView.addSubview(tip)

let close = UIButton(type: .custom)
close.setImage(UIImage(named:"g_close"), for: .normal)
close.frame = CGRect(x: bgView.bounds.width - 20, y: -10, width: 30, height: 30)
close.addTarget(self, action: #selector(closeAction(btn:)), for: .touchUpInside)
bgView.addSubview(close)

let animation = CABasicAnimation(keyPath: "transform.rotation.z")
animation.toValue = M_PI*2
animation.duration = 1.0
animation.repeatCount = MAXFLOAT
loadView.layer.add(animation, forKey: "rotate")
}

@objc func closeAction(btn:UIButton){
if let close = closeClosure{
close()
}
}
}

extension IndicatableView where Self:UIViewController{
func showActivityView(){
let loadView:QSLoadingView = QSLoadingView(frame: UIScreen.main.bounds)
loadView.closeClosure = {
self.hideActivityView()
}
KeyWindow?.insertSubview(loadView, at: KeyWindow?.subviews.count ?? 0)
}

func hideActivityView(){
if let subviews = KeyWindow?.subviews {
for item in subviews {
if item.isKind(of: QSLoadingView.self) {
item.removeFromSuperview()
}
}
}
}
}
Loading

0 comments on commit 52b1df9

Please sign in to comment.