ios - Create a floating button over a UITableView -
this question has answer here:
i saw ios floating button on table view regarding how create floating button. way create button. problem button scroll table view.
uibutton *button = [uibutton buttonwithtype:uibuttontyperoundedrect]; [button addtarget:self action:@selector(amethod:) forcontrolevents:uicontroleventtouchdown]; [button settitle:@"show view" forstate:uicontrolstatenormal]; button.frame = cgrectmake(80.0, 210.0, 160.0, 40.0); [view addsubview:button];
how can fix that?
i suggest use https://github.com/gizmoboy7/vcfloatingactionbutton link....hope work you
assign view controller delegate of table view , override scrollviewdidscroll:
- (void)scrollviewdidscroll:(uiscrollview *)scrollview { if ([scrollview isequal:self.tableview]) { self.floatingbutton.transform = cgaffinetransformmaketranslation(0, scrollview.contentoffset.y); } }
Comments
Post a Comment