I have make a alarm clock like default alarm clock on iphone/ipod. But I dont know How to create animation UItableviewcell when edit like native ios clock app.Please help me. thanks
Animation like this.
[tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
where UITableViewRowAnimation ca be one of these:
typedef enum {
UITableViewRowAnimationFade,
UITableViewRowAnimationRight,
UITableViewRowAnimationLeft,
UITableViewRowAnimationTop,
UITableViewRowAnimationBottom,
UITableViewRowAnimationNone,
UITableViewRowAnimationMiddle,
UITableViewRowAnimationAutomatic = 100
} UITableViewRowAnimation;
What I see happening is that the control is being hidden.
Both the UITableView and the UITableViewCell classes have a property called:
editing
as well as a method called:
- (void) setEditing : (BOOL) editing animated : (BOOL) animated;
Both of these may be used to place a UITableView/UITableViewCell in "editing" mode. The property may be used to create a UITableView/UITableViewCell and set it to "editing" mode before being added to the view hierarchy.
However, the method, while it may also be used to achieve the same thing programmatically, may also be used to override/enhance a UITableView's/UITableViewCell's "editing" behavior. In this case, it may be used by the UITableViewCell to be notified, by the very own UITableView of which the UITableViewCell is part, of the fact that the UITableView has been set to "Editing" mode:
- (void) setEditing : (BOOL) editing animated : (BOOL) animated
{ // setEditing:animated: ()
mySwitchView = [[self contentView] viewWithTag : 100];
CGFloat alphaValue = editing ? 0.0f : 1.0f;
[UIView animateWithDuration : 3.0f
animations : ^(void)
{
[mySlideView setAlpha : alphaValue];
}
} // setEditing:animated: ()
Therefore, if this were one of the UTableViewCell types provided by Apple. In order to have any control of ours be part of the UITableViewCell, it needs to be added to the UITableViewCell's content view in the UITableView's method provided by the UITableViewDataSource:
- (UITableViewCell*) tableView : (UITableView*) cellForRowAtIndexPath : (NSIndexPath*) indexPath
{ // tableView:cellForRowAtIndexPath: ()
static cellIdentifier = @"cell-identifier";
UISwitchView* switchView = nil;
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier : cellIdentifier];
if (cell == nil)
{ // if ()
switchView = [[UISwitchView alloc] initWithFrame : CGRectZero];
cell = [[[UITableViewCell alloc] initWithStyle : UITableViewCellStyleDefault
reuseIdentifier : cellIdentifier] autorelease];
[switchView setTag : 100];
[[cell contentView] addSubview : switchView];
[switchView release];
switchView = nil;
} // if ()
return (cell);
} // tableView:cellForRowAtIndexPath: ()
I do hope this answers your question.
Cheers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.