並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 15 件 / 15件

新着順 人気順

UIButtonの検索結果1 - 15 件 / 15件

  • UIButton: Padding Between Image and Text

    UIButton: Padding Between Image and TextMay 6, 2019 Update (11/29/2020): I've updated this post to note that more subtlety is required to account for right-to-left languages. Pop quiz: in a UIButton, how do you set a padding of 10pt between the image and the title? I had to do this at work recently, and I was surprised at how hard it was to reason about. There are several posts talking about this

      UIButton: Padding Between Image and Text
    • UIButtonに隠しActionをつける方法 - Qiita

      はじめに ただどう動くんだろう?って言うだけの話で実用性は皆無です なんか UIButton に謎のアクションを付けれたというお話です。 環境 Xcode 11.4 iPhone 11 Pro Max (13.4) 実装 StoryboardでFirstViewControllerとSecondViewControllerを用意する FirstVCにボタンをのせる IBActionでボタンのアクションをFirstVCに紐付ける(tappedFirst(_ sender: Any)) SecondVCにFirstVCのボタンをコピペする IBActionでボタンのアクションをSecondVCに紐付ける(tappedSecond(_ sender: Any)) こんな感じ final class FirstViewController: UIViewController { @IBAction

        UIButtonに隠しActionをつける方法 - Qiita
      • A new way to style UIButton with UIButton.Configuration in iOS 15 | Sarunw

        Translate your app In 1 click: Simplifies app localization and helps you reach more users. Try it for Free The first part in the series "What's new in UIKit button". An introduction to a new button configuration, a struct that is shaping and styling your button. You no longer need to subclass UIButton ever again with button configuration. Button Configuration Dynamic Button Configuration Custom bu

          A new way to style UIButton with UIButton.Configuration in iOS 15 | Sarunw
        • 【Swift】UIButtonのtitleLabel.fontでフォントが変わらないときの対処法

          iOS15からUIButtonの扱いが変更されました。 それに伴い、単にtitleLabel.fontで指定してもフォントを変えられなくなりました。 iOS15より前のバージョンをサポートする場合であっても使える対処法が以下となります。 if #available(iOS 15.0, *) { button.configuration = nil } button.titleLabel?.font = UIFont(name: "Zapfino", size: 20) } iOS15のボタンには、基本的にPlain, Gray, Titted, Filledの4つのスタイルがあります。 スタイルはconfigurationで指定できるのですが、これはiOS15で追加されたものです。 そのため、iOS15より前もサポートする場合はボタンのスタイルをDefaultに変更する必要があります。 S

            【Swift】UIButtonのtitleLabel.fontでフォントが変わらないときの対処法
          • 【SwiftUI】UIButtonで理解するUIデザイントレンド

            ※ この記事は ZOZO Advent Calendar 2022 カレンダーVol.4の10日目の記事になります。 こんにちは、 ogijun です。 Swiftをコードでざっくり理解第3弾、今回はUIデザインについて書いていきます。 iOSのデザイントレンドといえば、僕の中では立体的で実写的なデザインがフラットなデザインに変わったiOS7が強く印象に残っています。 最近のUIデザインは比較的フラットデザインのエッセンスを継承しているのでiOS7ほどの衝撃はありませんが、実は少しずつトレンドは移り変わっていることをご存じでしょうか。 今回は、今までのUIデザイントレンドを時系列順にUIButtonを実装しながら特徴を理解してみます。 ※ 各デザインの実装例はgithubにて公開中です。参考にどうぞ。 スキューモーフィズム スマートフォンが登場した頃によく採用されていたUIデザインはスキュ

              【SwiftUI】UIButtonで理解するUIデザイントレンド
            • 【Swift】UIButtonを丸くする方法(基本文法)

              UIButtonを角丸にする方法。かわいい感じのUIにしたいときによく使うのでメモ。 Buttonクラスが直接持つプロパティではなく、 Buttonクラスの持つCALayerで調整する。 実行環境 Swift:4.1.2 Xcode:10.1 import UIKit class ViewController: UIViewController { @IBOutlet weak var button: UIButton! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. } override func viewDidLayoutSubviews() { super.viewDidLayoutSub

                【Swift】UIButtonを丸くする方法(基本文法)
              • 【iOS】UIButtonにON/OFFのスイッチ処理を1行で書く【Swift】 - Qiita

                UIButtonに「on/off」のスイッチを付与したい... けどいちいちフラグ立てるのはスマートじゃない... それに複数のUIButtonにon/offのスイッチを持たせるとなったらアーッ ってことで、UIButtonにon/offのスイッチを持たせたい時に、簡単一行でon/offのスイッチを実装するコードを書いたので(誰でもやってるかもしれないけど)晒したいと思います。 sample 開発環境 Swift5.0 Xcode10.1 目的 UIButtonにON/OFFのスイッチ機能を持たせたい時に、下のように書くのはスマートじゃない。 @IBOutlet var label: UILabel! var flag: Bool = false @IBAction func tappedButton(_ sender: UIButton) { if flag == false { //O

                  【iOS】UIButtonにON/OFFのスイッチ処理を1行で書く【Swift】 - Qiita
                • UIButtonのAddTargetを書きたくない。 - Qiita

                  let b = UIButton() b.onTap { print("on tap") } 実装方法はgithubでカンニングした。 実装 黒魔術を使う objcのランタイム関数を使ってUIButtonのプロパティーにclosureを保持する構造体追加する typealias TapClosure = ()->Swift.Void class Tapable { static var key = "ON_TAP_KEY" private var base: UIButton init(_ base: UIButton) { self.base = base } var onTouchUpInside: TapClosure? { didSet { base.addTarget(self, action: #selector(touchUpInside), for: .touchUpIns

                    UIButtonのAddTargetを書きたくない。 - Qiita
                  • SwiftでUIButtonを動的に生成しクリックされたボタンを判別する方法 - Qiita

                    SwiftでUIButtonを動的に生成しクリックされたボタンを判別する方法です。 UIButtonを継承したクラスを作って実現しています。 もっとスマートな方法があれば教えてほしいです。 ソース ViewController.swift import UIKit class ViewController: UIViewController { // UIButtonを継承した独自クラス class MyButton: UIButton{ let x:Int let y:Int init(x:Int,y:Int,frame:CGRect){ self.x = x self.y = y super.init(frame:frame) } required init(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been

                      SwiftでUIButtonを動的に生成しクリックされたボタンを判別する方法 - Qiita
                    • UIButtonでタイトルを改行する方法 in Swift3.0 - Qiita

                      開発環境 Xcode8.1 Swift3.0 + Autolayout iOS9+ Autolayoutでハマった UIButtonのタイトルなんて、簡単に改行できるだろうと思っていました。 ところが、どっこいかなり苦戦し半日程浪費してしまいました。 実現方法 (1)以下のUIButtonのサブクラスを作成 import UIKit class MultiLineButton: UIButton { required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.commonInit() } private func commonInit() { self.titleLabel?.numberOfLines = 0 self.titleLabel?.lineBreakMode = .byWordWrapp

                        UIButtonでタイトルを改行する方法 in Swift3.0 - Qiita
                      • UIButton のPaddingにハマった件。 | ひつじ村

                        UIButtonのデフォルト設定されてる余白をどうにか取り除かならなくて、やり方分からず数時間消えた。 Pop quiz: in a UIButton, how do you set a padding of 10pt between the image and the title? I had to do this at work recently, and I was surprised at how hard it...

                          UIButton のPaddingにハマった件。 | ひつじ村
                        • 【iOS】UIButtonにON/OFFのスイッチ処理を1行で書く【Swift】 - Qiita

                          UIButtonに「on/off」のスイッチを付与したい... けどいちいちフラグ立てるのはスマートじゃない... それに複数のUIButtonにon/offのスイッチを持たせるとなったらアーッ ってことで、UIButtonにon/offのスイッチを持たせたい時に、簡単一行でon/offのスイッチを実装するコードを書いたので(誰でもやってるかもしれないけど)晒したいと思います。 sample 開発環境 Swift5.0 Xcode10.1 目的 UIButtonにON/OFFのスイッチ機能を持たせたい時に、下のように書くのはスマートじゃない。 @IBOutlet var label: UILabel! var flag: Bool = false @IBAction func tappedButton(_ sender: UIButton) { if flag == false { //O

                            【iOS】UIButtonにON/OFFのスイッチ処理を1行で書く【Swift】 - Qiita
                          • UIButtonのsetimageが青くなる|tak lab.

                            Xcode7 swift2 UIButtonを用意した画像に置き換え、 アクション接続をした後にsetimageを使って画像を変更しようとしたらなんだかわからないけど青くなっちゃった! って場合の対処。 ButtonのTypeをSystemからCustomにします これだけ。

                              UIButtonのsetimageが青くなる|tak lab.
                            • Virt-A-Mate - UIButtonでUndress -

                              VaMの服はものによってはUndressでするりと脱がすことが出来る。 https://neo-sahara.com/wp/wp-content/uploads/2021/05/vam_undress_trigger_01.mp4 これをUIButtonのクリックでやるのにちょっと迷ったので覚書きする。 こういうことをやりたい。 https://neo-sahara.com/wp/wp-content/uploads/2021/05/vam_undress_trigger_02.mp4 UIButtonを追加したら、 Button Trigger > Add Click Action > Settings とたどる。 ここで対象を選択するにだが、これが見つけにくい。 下のように選択する。 R

                              • 【iOS】UIButtonにON/OFFのスイッチ処理を1行で書く【Swift】 - Qiita

                                UIButtonに「on/off」のスイッチを付与したい... けどいちいちフラグ立てるのはスマートじゃない... それに複数のUIButtonにon/offのスイッチを持たせるとなったらアーッ ってことで、UIButtonにon/offのスイッチを持たせたい時に、簡単一行でon/offのスイッチを実装するコードを書いたので(誰でもやってるかもしれないけど)晒したいと思います。 sample 開発環境 Swift5.0 Xcode10.1 目的 UIButtonにON/OFFのスイッチ機能を持たせたい時に、下のように書くのはスマートじゃない。 @IBOutlet var label: UILabel! var flag: Bool = false @IBAction func tappedButton(_ sender: UIButton) { if flag == false { //O

                                  【iOS】UIButtonにON/OFFのスイッチ処理を1行で書く【Swift】 - Qiita
                                1