Duplicate the UIButton and Move it

跟風遠走 提交于 2020-01-17 03:05:11

问题


I have one UIButton(lets say instance1).I have set target method when it moves.So when I try to move(drag) I want to do that create copy of instance1 and that copy button should be moved(dragged).Yes I know that -copy will not support to UIButton.So I used :

NSData *archivedData = [NSKeyedArchiver archivedDataWithRootObject: sender];
UIButton *buttonCopy = [NSKeyedUnarchiver unarchiveObjectWithData: archivedData];

But the problem is when I am trying to move copy button,its not moving and on second attempt it is hiding/removing from screen.Please help me.

来源:https://stackoverflow.com/questions/19241208/duplicate-the-uibutton-and-move-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!