Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-28-2011, 04:33 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 2
newklex is on a distinguished road
Default UIImageViews to make copies of themselves after being dragged and dropped

I'm trying to get the UIImageViews to make copies of themselves after being dragged and dropped. For example: I have UIImageViews for all the letters of the alphabet.

I hooked them all up using Interface Builder, and they move independently of each other.

I pull an "A" tile (image view) from the alphabet to spell a word.

Currently, if the A is pulled out, I have no other "A" image view to use a second "A" if there are two "A's" in the word to be spelled out.

My weak attempt to create another letter tile:

Code:
for(UITouch *touch in [event allTouches])
    if ([touch view] == alphabetVowelA) {
        MainSpellingView *alphabetA;
        CGRect alphabetAa = CGRectMake(39, 104, 70, 70);
        alphabetA = [[MainSpellingView alloc] initWithFrame:alphabetAa];
        [alphabetA setImage:[UIImage imageNamed:@"a.png"]];
        [alphabetA setMultipleTouchEnabled:YES];
        [alphabetA setUserInteractionEnabled:YES];
        [self addSubview:alphabetA];
        CGPoint location = [touch locationInView:self];
        alphabetVowelA.center = location;
    }
My code: (I only have A, B, and C move) I figure if I can get the first three letters to do what I want, I can make them all do that. So to make things easier to work with and read, you'll notice that only three of them are set up to do anything.

MainSpellingView.m
MainSpellingView.h

TheViewController.h
TheViewController.m

While this code does create another tile using the "a" image in the original location I can't get it to move since it was created after the touchesbegan: and it of course would only work once in creating the new tile.

Ultimately, I want to have a letter tile (UIImageView) regenerate a duplicate of itself in its original location, so that if I need to use another of the same letter, I can simply drag the duplicate that was made once the original "letter tile" (UIImageView) was dragged and dropped down to the "spelling" area.

Thanks in advance for any code or direction you can give me!

Last edited by newklex; 08-28-2011 at 04:40 PM.
newklex is offline   Reply With Quote
Reply

Bookmarks

Tags
ios, ipad, iphone, uiimageview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 389
5 members and 384 guests
JackReidy, jeroenkeij, Sami Gh, Yosh_K
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,671
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, JackReidy
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:48 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0