Skip to content

Instantly share code, notes, and snippets.

View rename_file.py
import os
#先取得該檔案夾內所有的檔案名稱
def get_list():
all_name = os.listdir()
return all_name
n = 11
cafeIndex = '2342'
View AdModTableViewController.swift
import GoogleMobileAds
class TableViewController: UIViewController, UITableViewDelegate, GADBannerViewDelegate {
var bannerView: GADBannerView?
override func viewDidLoad() {
super.viewDidLoad()
//adSize有多種選擇,可以去官方文件裡面參考,這邊用的是iphone直立使用的size
bannerView = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)
//下面這邊unitID,請填如你自己的,或是官方給的測試ID
View adModAppDelegate.swift
import GoogleMobileAds
class AppDelegate:UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
//這邊要做的只有兩件事,一個是import GoogleMobileAds
//另一個就是在didFinishLaunchingWithOptions裡面輸入下面這一行
GADMobileAds.configure(withApplicationID: "這邊就是你自己的 app ID ")
return true
}
}
View getPhoto.py
import googlemaps
import os
google_key = "AIzaSyCLfZQjoR4uuH3-gikZOf01XLltl_bSlxx"
gmaps = googlemaps.Client(key = google_key)
#前面一樣要先取得google key,還有設定client
#下面這邊,我假設妳已經取得了10個photo_reference,並且將他們存在list裡面
View timingTestViewController.swift
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
print("A viewDidLoad")
}
View timingTestAppDelegate.swift
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
View getUserLocation.swift
//
// ViewController.swift
// myNavegationLayoutAndToolBar
//
// Created by Chang Shu Hao on 2018/5/5.
// Copyright © 2018年 Gary. All rights reserved.
//
import UIKit
import CoreLocation
View getUserLocation.swift
import UIKit
import CoreLocation
class TableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, CLLocationManagerDelegate {
var myLocationManager : CLLocationManager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
View AskUserLocationWhenLunch.swift
import UIKit
import CoreLocation
import MapKit
//記得要import CoreLocation跟Mapkit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, CLLocationManagerDelegate {
View userLocationGet.swift
import UIKit
import CoreLocation
import MapKit
class ViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate {
let locationManager: CLLocationManager? = CLLocationManager()
@IBOutlet weak var mapView: MKMapView!