버튼을 배치 할 때 위/아래로 슬라이드하는 표의 막대에 알림 개수를 나타 내기 위해 UIButton을 사용하고 있습니다. 버튼의 제목은 읽지 않은 알림 수를 나타 내기 위해 동적으로 변경됩니다.버튼의 가치 코어 애니메이션 블록의 애니메이션 제목
첨부 된 부분 스크린 샷을 참조하십시오. 애니메이션의
시작 프레임 - 0으로 표시 알림 - - 애니메이션의 올바르게
최종 프레임 - 2로 보여주는 알림이 아래
을 변경하지 마십시오 내가 애니메이션을 사용하고있는 코드입니다 녹색 줄이있는 UIView이고 알림 것을
-(IBAction) showNotifications {
if (notificationTableIsUp) {
CGRect notificationsHeaderFrame = notificationsHeader.frame;
CGRect notificationsTableFrame = notificationsTable.frame;
// Animate to pull up Notification Table
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.4];
notificationTableIsUp = !notificationTableIsUp;
notificationsHeaderFrame.origin.y += 220;
notificationsHeader.frame = notificationsHeaderFrame;
notificationsTableFrame.origin.y += 220;
notificationsTable.frame = notificationsTableFrame;
[UIView commitAnimations];
} else {
CGRect notificationsHeaderFrame = notificationsHeader.frame;
CGRect notificationsTableFrame = notificationsTable.frame;
// Animate to pull down Notification Table
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.4];
notificationTableIsUp = !notificationTableIsUp;
notificationsHeaderFrame.origin.y -= 220;
notificationsHeader.frame = notificationsHeaderFrame;
notificationsTableFrame.origin.y -= 220;
notificationsTable.frame = notificationsTableFrame;
[UIView commitAnimations];
}
}
- (void)viewDidLoad {
[super viewDidLoad];
notificationTableIsUp = NO;
[self updateNotificationBadgeTo:2];
}
- (void) updateNotificationBadgeTo:(NSInteger)numberOfNotifications {
notificationBadgeButton.titleLabel.font = [UIFont boldSystemFontOfSize:14];
notificationBadgeButton.titleLabel.textColor = [UIColor whiteColor];
notificationBadgeButton.titleLabel.text = [NSString stringWithFormat:@"%d", numberOfNotifications];
}
참고는 UILabel의 및 라운드 버튼을 모두 I에서 설정있는 UIButton입니다 비. 0은 IB에 설정된 버튼의 초기 제목입니다. viewDidLoad에서 2로 설정하고 있습니다.
그래서 여기에서 기본 문제는 버튼 2를 흰색 (viewDidLoad에서 설정)에서 파란색 0 (IB로 설정)으로 변경하는 값을 클릭하는 것입니다.
슬라이드를 움직이게 할 때이 부분을 제거하려면 어떻게해야합니까?
감사합니다. Dev.