• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How do I copy a view?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I copy a view?


  • Subject: How do I copy a view?
  • From: "Philip Dhingra" <email@hidden>
  • Date: Thu, 10 Jul 2008 22:21:03 -0500

I'm trying to add a copy of a view as a subview to the parent view. This is
what I tried:

UIButton* firstButton = [[UIButton alloc] initWithFrame:CGRectMake(0,0,360,
360)];

NSData *btnData = [NSArchiver archivedDataWithRootObject:firstButton]; //
Breaks Here

[parentView addSubview:firstButton];

 UIButton *twin = [NSKeyedUnarchiver unarchiveObjectWithData:btnData];

[parentView addSubview:twin];

It breaks when I try to archive the object, and I don't get any error
message in the console. Maybe there's another error console (I'm new to
Cocoa) that shows what's wrong.

Is there any way to copy or mirror a view?

Thanks,

Phil
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How do I copy a view?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Setting Finder comments and keywords
  • Next by Date: Re: JDBC Frameworks?
  • Previous by thread: Re: Setting DPI of image data
  • Next by thread: Re: How do I copy a view?
  • Index(es):
    • Date
    • Thread