페이지

2019년 11월 28일 목요일

C# Extension vs Swift Extension

C# Extesion


using System;
                    
public class Gun{
    public void fireDoubles(){
        fire(); // error: 'fire' does not exist in the current context
        
        this.fire(); // ok

        Console.WriteLine("fire2");
    }
}


public static class GunExtension{
    public static void firethis Gun gun ){
        Console.WriteLine("fire");
    }
}

public class Program
{
    public static void Main()
    {
        var gun = new Gun();
        gun.fireDoubles();
    }
    


}


Swift Extesion


import Foundation

class Gun {
    func fireDoubles(){
        fire() // no error
        print("fire2")
    }
}

extension Gun {
    func fire(){
        print("fire")
    }
}

let g = Gun()
g.fireDoubles()

2019년 4월 29일 월요일

"The address entered appears to be invalid." in app Store Connect

When this error comes on in app store connect page, delete last hidden character in each address field.

2018년 8월 26일 일요일

Awake() not called when inactive gameobject

if a prefab is inactive, the prefab Awake() not called after instantiated.

 set gameobject active after instantiating it or set prefab active.

 but you can call your own method in inactive gameobject.
 Inactive Gameobject means that there is nothing in unity scene world. Unity API not called. Awake(), Start(), Update(), OnCollision() and so on...

2017년 11월 3일 금요일

Dynamically Sized Table View Header or Footer Using Auto Layout

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    // Dynamic sizing for the header view
    if let headerView = tableView.tableHeaderView {
        let height = headerView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height
        var headerFrame = headerView.frame

        // If we don't have this check, viewDidLayoutSubviews() will get
        // repeatedly, causing the app to hang.

        if height != headerFrame.size.height {
            headerFrame.size.height = height
            headerView.frame = headerFrame
            tableView.tableHeaderView = headerView
        }
    }
}


http://collindonnell.com/2015/09/29/dynamically-sized-table-view-header-or-footer-using-auto-layout/