Predefined styles. Trailing images! Loading style and much more.
seen from Netherlands
seen from Switzerland
seen from Italy
seen from China
seen from Switzerland
seen from China
seen from Egypt
seen from China

seen from United States
seen from Netherlands
seen from China

seen from Malaysia
seen from China
seen from Singapore

seen from Australia

seen from Germany

seen from India

seen from United Kingdom
seen from United States

seen from United Kingdom
Predefined styles. Trailing images! Loading style and much more.
Add Shadow to a Button iOS Tutorial
Every View has a backing layer property. This layer has properties for performing animations and transforms, but also for rendering options. In this tutorial the layer property will be used to create a drop shadow. This tutorial is made with Xcode 10 and built for iOS 12.
Open Xcode and create a new Single View App.
For product name, use iOSShadowButtonTutorial and then fill out the Organization Name and Organization Identifier with your customary values. Enter Swift as Language and choose Next.
Go to the Storyboard. Add a Button to the main view and give it a title of "Shadow Tutorial". Select the Resolve Auto Layout Issues button and select Reset to Suggested Constraints.
The Storyboard should look like this.
Select the Assistant Editor and make sure the ViewController.swift file is visible. Ctrl-drag or right-click-drag from the Button to the ViewController class and create the following Outlet.
Change the viewDidLoad method to
override func viewDidLoad() { super.viewDidLoad() button.layer.shadowColor = UIColor.black.cgColor button.layer.shadowOffset = CGSize(width: 5, height: 5) button.layer.shadowRadius = 5 button.layer.shadowOpacity = 1.0 }
Every View has a layer property which you can use to create drop shadows. Here we set the color to black and we give the shadow a offset of 5 x 5. The shadowRadius property is set to 5 to round off the corners of the shadow a bit. To show the shadow we need to set the shadowOpacity property between 0.0 and 1.0. (1.0 is darkest).
Build and run the project, the drop shadow is visible beneath the button.
You can download the source code of the iOSShadowButtonTutorial at the ioscreator repository on Github
my review point is 10/10
UIButton(type : .system ) 으로 버튼생성하는 경우 기본적으로 시스템 버튼 스타일이 적요된다. 마우스가 버튼위로 올라가는 경우 색깔이 변한다든가 등등.
https://youtu.be/YLnPUj9TvKI?t=7m51s stackview 적용하기
https://youtu.be/YLnPUj9TvKI?t=16m25s 기기를 옆으로 돌리는 경우 레이아웃이 새로 만들어지게 하는 방법 ( willTransition함수내에서 invalidLayout 수행)
JTImageButton is a UIButton subclass that makes title+image work easier.
Taking use of UIColor as UIImage when UIButton's control state is highlighted.
https://gist.github.com/fxwx23/b5edf1e93bfbc68c3249
[iOS] Get the title of UIButton
UIButton에는 titleLabel이라는 UILabel property가 있다. UIButton에 설정한 Title String은, button.titleLabe.text로 가져오면 되는줄 알았는데, 아무리 호출해보아도 값이 안온다..
생각해보니 UIButton에서 title을 설정할 때, State별로 설정을 할 수 있는데, title을 가져올 때에도 State별로 가져와야 한다.. (사실 당연한건데..)
해답은 UIKit의 UIButton.h 파일을 정독해보면 나온다.
- (NSString *)titleForState:(UIControlState)state; // these getters only take a single state value
위의 메서드를 아래와 같이 호출하면 된다.
NSString *theRealTitle = [myButton titleForState:UIControlStateNormal]; // Get the title of myButton for normal state
Title 뿐만 아니라, Title Color, Title Shadow Color, Image, Background Image, Attributed Title도 위와 같은 방식으로 호출하면 된다. 해당 메소드들은 아래에 있다. (UIKit/UIButton.h)
- (NSString *)titleForState:(UIControlState)state; // these getters only take a single state value - (UIColor *)titleColorForState:(UIControlState)state; - (UIColor *)titleShadowColorForState:(UIControlState)state; - (UIImage *)imageForState:(UIControlState)state; - (UIImage *)backgroundImageForState:(UIControlState)state; - (NSAttributedString *)attributedTitleForState:(UIControlState)state NS_AVAILABLE_IOS(6_0);