Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

adding label to navigation bar

if let navigationBar = self.navigationController?.navigationBar {
    let firstFrame = CGRect(x: 0, y: 0, width: navigationBar.frame.width/2, height: navigationBar.frame.height)
    let secondFrame = CGRect(x: navigationBar.frame.width/2, y: 0, width: navigationBar.frame.width/2, height: navigationBar.frame.height)

    let firstLabel = UILabel(frame: firstFrame)
    firstLabel.text = "First"

    let secondLabel = UILabel(frame: secondFrame)
    secondLabel.text = "Second"

    navigationBar.addSubview(firstLabel)
    navigationBar.addSubview(secondLabel)
}
Comment

PREVIOUS NEXT
Code Example
Swift :: swift enum xib 
Swift :: swift create custom button with icon programmatically 
Swift :: swiftui line break text 
Swift :: swift view 
Swift :: swift switch statement 
Swift :: swift firebase realtime db class 
Swift :: Swift Access Array Elements 
Swift :: swift comment 
Swift :: Swift Double 
Swift :: move view controller to make space for keyboard swift 5 
Swift :: Swift Access Struct Properties Swift 
Swift :: swift do catch where 
Swift :: Swift Named Tuple 
Swift :: Swift convenience Initializer 
Swift :: xcode button center text 
Swift :: Swift Access Elements from Dictionary 
Swift :: Swift Arithmetic Operators 
Swift :: Swift Loop Statements 
Swift :: swift how to append an element 
Swift :: Swift Left Shift Operator 
Swift :: Swift Literals 
Swift :: Swift Difference between Two Sets 
Swift :: microsoft flight simulator uses which language 
Ruby :: how to check if data is an array or not ruby 
Ruby :: rails generate model 
Ruby :: rails routes grep 
Ruby :: ruby generate random number 
Ruby :: how to format date and time in rails 
Ruby :: method delete rails not working 
Ruby :: ruby decimal to hex 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =