Skip to content

Instantly share code, notes, and snippets.

View Alicelovecode's full-sized avatar

Alicelovecode

View GitHub Profile
@Alicelovecode
Alicelovecode / clima1.swift
Created August 19, 2017 08:49
clima1.swift
import UIKit
import CoreLocation
class WeatherViewController: UIViewController,CLLocationManagerDelegate {
//Constants
let WEATHER_URL = "http://api.openweathermap.org/data/2.5/weather"
let APP_ID = "e72ca729af228beabd5d20e3b7749713"
@Alicelovecode
Alicelovecode / Destini.swift
Last active August 17, 2017 13:05
Destini.swift
import UIKit
class ViewController: UIViewController {
// Our strings
let story1 = "Your car has blown a tire on a winding road in the middle of nowhere with no cell phone reception. You decide to hitchhike. A rusty pickup truck rumbles to a stop next to you. A man with a wide brimmed hat with soulless eyes opens the passenger door for you and asks: \"Need a ride, boy?\"."
let answer1a = "I\'ll hop in. Thanks for the help!"
let answer1b = "Better ask him if he\'s a murderer first."
let story2 = "He nods slowly, unphased by the question."
@Alicelovecode
Alicelovecode / seefood4.swift
Created August 12, 2017 15:18
seefood4.swift
import UIKit
import VisualRecognitionV3
import SVProgressHUD
class ViewController: UIViewController,UINavigationControllerDelegate,UIImagePickerControllerDelegate {
let apiKey = "f394cba206eb4ff8778fce96d95801f7494fdfc8"
let version = "2017-08-12"
@IBOutlet weak var imageView: UIImageView!
@Alicelovecode
Alicelovecode / seefood3.swift
Created August 12, 2017 14:53
seefood3.swift
//
// ViewController.swift
// seefood
//
// Created by 張書涵 on 2017/8/12.
// Copyright © 2017年 AliceChang. All rights reserved.
//
import UIKit
import VisualRecognitionV3
@Alicelovecode
Alicelovecode / seefood.swift
Created August 12, 2017 14:31
seefood.swift
import UIKit
import VisualRecognitionV3
class ViewController: UIViewController,UINavigationControllerDelegate,UIImagePickerControllerDelegate {
let apiKey = "f394cba206eb4ff8778fce96d95801f7494fdfc8"
let version = "2017-08-12"
@IBOutlet weak var imageView: UIImageView!
@IBOutlet weak var cameraButton: UIBarButtonItem!
@Alicelovecode
Alicelovecode / seefood2.swift
Created August 12, 2017 13:28
seefood2.swift
import UIKit
import VisualRecognitionV3
class ViewController: UIViewController,UINavigationControllerDelegate,UIImagePickerControllerDelegate {
let apiKey = "********************"
//輸入你自己的IBMapiKey:長得像是f394cba206eb4ff8779fce96d95801f7494fdfc2的數字與英文字串
let version = "2017-08-12"
@IBOutlet weak var imageView: UIImageView!
@Alicelovecode
Alicelovecode / seefood1.swift
Created August 12, 2017 09:05
seefood1.swift
import UIKit
class ViewController: UIViewController,UIImagePickerControllerDelegate,UINavigationControllerDelegate{
//加入UIImagePickerControllerDelegate屬性才能使用相機相關的內容,加入UINavigationControllerDelegate才能讓畫面順利往右
@IBOutlet weak var ImageView: UIImageView!
@IBOutlet weak var cameraButton: UIBarButtonItem!
let imagePicker = UIImagePickerController()
@Alicelovecode
Alicelovecode / searchbar.swift
Created August 4, 2017 04:54
searchbar.swift
// TableViewController.swift
// table
//
// Created by 張書涵 on 2017/8/3.
// Copyright © 2017年 AliceChang. All rights reserved.
import UIKit
class TableViewController: UITableViewController ,UISearchResultsUpdating {
let appleProduct = ["Apple TV", "Apple Watch", "iMac", "iPhone", "Macbook Pro", "iPad", "iPod", "Air Pod"]
@Alicelovecode
Alicelovecode / UILongPressGestureRecognizer.swift
Created July 30, 2017 03:18
UILongPressGestureRecognizer.swift
override func viewDidLoad() {
super.viewDidLoad()
buttonArray = [button1,button2,button3,button4,button5]
if buttonArray != nil{
for button in buttonArray!{
let lpgr = UILongPressGestureRecognizer(target: self, action: #selector(ViewController.longPress(sender:)))
lpgr.minimumPressDuration = 1.5
button.addGestureRecognizer(lpgr)
}
}
import UIKit
class ContentViewController: UIViewController{
var nowPageNumber = 0
@IBOutlet weak var mainImageView: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
mainImageView.image = UIImage(named:"\(nowPageNumber)")
}