iOS etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
iOS etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

26 Ocak 2015 Pazartesi

Basic AutoLayout Example in iOS -2








Let's make a basic autolayout example by using two label , an imageview and a scrollview.


Firstly add an imageview the upper left corner.

height = 80
width = 80

We should add constraints for the imageview and define width and height sizes.




Secondly add a label right of imageview.
In order to add top space, we choose Top space to Top Layout Guide
In order to save space between imageview and label, we choose left space.


Add a scrollview below imageview and label.
We should add constraints for the scrollview and define width and height sizes.
In order to change size of scrollview according to iPhone sizes, we choose "Equal Widths" for its width.

Also ,we must design its height size according to iPhone sizes. Therefore we set 0 bottom space. And we set 0 left space.


Finally, let's add a label center of scrollview. We must choose "Center Horizontally in Container" and "Center Vertically in Container

Update Frames all views :)

Let's control all views for different iPhone sizes.


Result






          

24 Ocak 2015 Cumartesi

Basic AutoLayout Example in iOS - 1

Let's make a basic autolayout example.

Firstly add a blue view the upper left corner.

Add the constraints for the blue view

height = 100
width = 100


Update Frames for blue view






Seconly, add a purple view the center

Add the constraints for the purple view

height = 200
width = 200


In order to show a view on the center, we must add alignment constraints:
1. Horizontal center in Container
2. Vertical center in Container


Update Frames for purple view


Finally add a orange view the upper left corner.

Add the constraints for the orange view

height = 100
width = 100

Update Frames for orange view

Let's control storyboard preview for iPhone sizes.




Result for iPhone 6








You can download from  https://github.com/ozlemakalin/BasicAutoLayoutExample





15 Ocak 2015 Perşembe

Custom Button in Swift



Custom Buttons 

Create a swift file for custom button










Create a custom button class



class CustomButton: UIButton {
     required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        self.layer.borderColor = UIColor.yellowColor().CGColor
        self.layer.borderWidth = 5
        self.backgroundColor = UIColor.redColor()
        
}


}


Define custom button class in Storyboard






For custom button with imageview and label

Create view and add imageview and label in view
Add button on image view and label
Define constraints







 Result



You can download from https://github.com/ozlemakalin/custombuttonswift





2 Ocak 2015 Cuma

Custom tableviewcell iOS Development in Swift


Custom tableviewcell example is developed for Swift language.

An examle for Custom tableviewcell in mobile development

Create a new project




Choose swift language


Add a table view and TableView Delegate and DataSource protocols in ViewController