Added viewwillappear function.