Tutorial by Examples: au

You can animate a UIImageView by quickly displaying images on it in a sequence using the UIImageView's animation properties: imageView.animationImages = [UIImage(named: "image1")!, UIImage(named: "image2")!, UIImage(nam...
In classes, super.foo() will look in superclasses only. If you want to call a default implementation from a superinterface, you need to qualify super with the interface name: Fooable.super.foo(). public interface Fooable { default int foo() {return 3;} } public class A extends Object impl...
You can combine object initializers with constructors to initialize types if necessary. Take for example a class defined as such: public class Book { public string Title { get; set; } public string Author { get; set; } public Book(int id) { //do things } // the...
A Table View is a list of rows that can be selected. Each row is populated from a data source. This example creates a simple table view in which each row is a single line of text. Add a UITableView to your Storyboard Although there are a number of ways to create a UITableView, one of the easiest...
Auto layout is used to arrange views so that they look good on any device and orientation. Constraints are the rules that tell how everything should be laid down. They include pinning edges, centering, and setting sizes, among other things. Auto layout is enabled by default, but you can double chec...
Prefer public class Order { public OrderLine AddOrderLine(OrderLine orderLine) { if (orderLine == null) throw new ArgumentNullException(nameof(orderLine)); ... } } Over public class Order { public OrderLine AddOrderLine(OrderLine orderLine) { ...
To develop an application for iOS, you should start with an application called Xcode. There are other alternative tools you can use, but Xcode is Apple's official tool. Note, however, that it only runs on macOS. The latest official version is Xcode 8.3.3 with Xcode 9 (currently in beta) due to be re...
Objective-C CGRect myFrame = CGRectMake(0, 0, 320, 35) UIView *view = [[UIView alloc] initWithFrame:myFrame]; //Alternative way of defining the frame UIView *view = [[UIView alloc] init]; CGRect myFrame = view.frame; myFrame.size.width = 320; myFrame.size.height = 35; myFrame.origin.x = 0;...
An interface in Kotlin can have default implementations for functions: interface MyInterface { fun withImplementation() { print("withImplementation() was called") } } Classes implementing such interfaces will be able to use those functions without reimplementing cl...
The for and while compound statements (loops) can optionally have an else clause (in practice, this usage is fairly rare). The else clause only executes after a for loop terminates by iterating to completion, or after a while loop terminates by its conditional expression becoming false. for i in r...
A button can be disabled by Swift myButton.isEnabled = false Objective-C: myButton.enabled = NO; The button will become gray: If you don't want the button appearance to change when disabled set adjustsImageWhenDisabled to false / NO
There are many ways you can create a UIColor: Swift Using one of the predefined colors: let redColor = UIColor.redColor() let blueColor: UIColor = .blueColor() // In Swift 3, the "Color()" suffix is removed: let redColor = UIColor.red let blueColor: UIColor = .blue If the c...
To find a match, the regex engine will consume characters one by one. When a partial match begins, the engine will remember the start position so it can go back in case the following characters don't complete the match. If the match is complete, the is no backtracking If the match isn't complete...
def make_animal_sound(sound = 'Cuack') puts sound end make_animal_sound('Mooo') # Mooo make_animal_sound # Cuack It's possible to include defaults for multiple arguments: def make_animal_sound(sound = 'Cuack', volume = 11) play_sound(sound, volume) end make_animal_so...
Setting a default value can be done by using Initializers (C#6) public class Name { public string First { get; set; } = "James"; public string Last { get; set; } = "Smith"; } If it is read only you can return values like this: public class Name { pu...
Use a subquery to filter the result set. For example this will return all employees with a salary equal to the highest paid employee. SELECT * FROM Employees WHERE Salary = (SELECT MAX(Salary) FROM Employees)
A subquery in a FROM clause acts similarly to a temporary table that is generated during the execution of a query and lost afterwards. SELECT Managers.Id, Employees.Salary FROM ( SELECT Id FROM Employees WHERE ManagerId IS NULL ) AS Managers JOIN Employees ON Managers.Id = Employees.Id ...
SELECT Id, FName, LName, (SELECT COUNT(*) FROM Cars WHERE Cars.CustomerId = Customers.Id) AS NumberOfCars FROM Customers
Auto-implemented properties were introduced in C# 3. An auto-implemented property is declared with an empty getter and setter (accessors): public bool IsValid { get; set; } When an auto-implemented property is written in your code, the compiler creates a private anonymous field that can only be...
While composer provides a system to manage dependencies for PHP projects (e.g. from Packagist), it can also notably serve as an autoloader, specifying where to look for specific namespaces or include generic function files. It starts with the composer.json file: { // ... "autoload&q...

Page 4 of 37