Fix crash when setting selectedIndex before view appears.
Merge pull request #2 from lozhuf/master

Fix crash when setting selectedIndex before view appears.