Skip to content

Instantly share code, notes, and snippets.

View macbaszii's full-sized avatar
🏠
Working from home

iMacbaszii macbaszii

🏠
Working from home
View GitHub Profile
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if segue.identifier == "ViewImage" {
let imageViewController = segue.destinationViewController as ImgurImageViewController
let cell = sender as ImageCollectionViewCell
if let indexPath = imagesCollectionView.indexPathForCell(cell) {
imageViewController.imgurImage = images[indexPath.row]
}
}
}
@IBAction func touched(sender: AnyObject) {
if let button = sender as? Button {
button.setTitle("Touched", forState: .Normal)
}
}
@IBAction func touched(sender: AnyObject) {
if sender is UISegmentedControl {
let segmentedControl = sender as UISegmentedControl
let selectedIndex = segmentedControl.selectedSegmentIndex
@IBAction func touched(sender: AnyObject) {
if sender is UIButton {
let buttonTitle = (sender as UIButton).currentTitle
}
}
for item in toolbarItems! {
if let barButtonItem = item as? UIBarButtonItem {
// Do something with UIBarButtonItem
}
if let segmentedControl = item as? UISegmentedControl {
// Do something with UISegmentedControl
}
}
//
// PlacePickerViewController.swift
// TaxiReporter
//
// Created by Kiattisak Anoochitarom on 2/27/2558 BE.
// Copyright (c) 2558 Kiattisak Anoochitarom. All rights reserved.
//
import UIKit
import FacebookSDK
package main
import "fmt" // another package contains function
func main() {
var hello = "hello gopher!!" // type inference
// can be shorten in -> hello := "hello gopher!!"
fmt.Println(hello)
arr := [6]int{1, 2, 3, 4, 5}
Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(...........)
UIWindow:0x7f9481c93360
| •UIView:0x7f9481c9d680
| | *UIView:0x7f9481c9d990- AMBIGUOUS LAYOUT for UIView:0x7f9481c9d990.minX{id: 13}, UIView:0x7f9481c9d990.minY{id: 16}
| | *_UILayoutGuide:0x7f9481c9e160- AMBIGUOUS LAYOUT for _UILayoutGuide:0x7f9481c9e160.minY{id: 17}
| | *_UILayoutGuide:0x7f9481c9ebb0- AMBIGUOUS LAYOUT for _UILayoutGuide:0x7f9481c9ebb0.minY{id: 27}
(lldb) expr ((UIView *)0x7f9ea3d43410).backgroundColor = [UIColor redColor]
(UICachedDeviceRGBColor *) $1 = 0x00007f9ea3d43410
enum Optional<T> {
case None
case Some(T)
}