프로그래밍/iOS
[ios] 버튼 클릭시 로딩중 버튼 만들기
삶의안식처
2015. 4. 8. 18:21
버튼을 클릭 시 동작을 하는 함수가
- (IBAction) refresh : (id) sender
{
}
라고 가정하자
이 함수 안에서
UIActivityIndicatorView* spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle : UIActivityIndicatorViewStyleGray];
[spinner startAnimating];
self.button = [[UIButton alloc] initWithCustomView : spinner]; //현재 버튼 변수에 로딩중 버튼을 넣는다.
동작을 마치면
self.button = sender;
해주면 원래 모습으로 돌아간다. (sender 자체가 클릭한 버튼을 의미함)