작업 표의 날짜 선택 도구를 사용하여 시간을 선택하는 데이터를 표시하는 테이블보기가 있습니다. 이 테이블 뷰 UIswitch를 사용하여 작업 표에서 미리보기를 설정하십시오.
레이블 맞춤 셀 'ReminderCell'및 uiswitch 버튼을 갖는 각 행1.Custom 셀 ! [여기서 화상 정보 입력] [1]
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Note: I set the cell's Identifier property in Interface Builder to DemoTableViewCell.
ReminderCell *cell = (ReminderCell *)[tableView dequeueReusableCellWithIdentifier:CellClassName];
if (!cell)
{
NSArray *topLevelItems = [cellLoader instantiateWithOwner:self options:nil];
cell = [topLevelItems objectAtIndex:0];
}
//set from action sheet only this row 0
if(indexPath.row == 0)
{
if(date == nil)
{
date = [NSDate date];
}
NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
[timeFormatter setDateFormat:@"hh:mm a"];
cell.label.text = [timeFormatter stringFromDate:date];
}
사용자가 날짜 선택 팝업
와 액션 시트를 행을 선택
! [여기서 화상 정보 입력] [3]
,451,515,- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(date == nil)
{
date = [NSDate date];
}
NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init];
[timeFormatter setDateFormat:@"hh:mm a"];
//Add Action sheet
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Done",nil];
// Add date picker to the action sheet
datePicker = [[UIDatePicker alloc] init];
datePicker.datePickerMode = UIDatePickerModeTime;
[actionSheet addSubview:datePicker];
[actionSheet showInView:self.navigationController.tabBarController.view];
[actionSheet setBounds:CGRectMake(0,0,320, 550)];
[datePicker setFrame:CGRectMake(0, 138, 320, 216)];
[datePicker release];
[actionSheet release];
}
이제 내가이 날짜 선택에서 선택 날짜별로 알림을 설정하고에 때 스위치를 설정할 필요가 없다. 미리 감사드립니다.