[ad_1]
I have used the code as:-
- (void) touchesBegan:(NSSet *) touches withEvent:(UIEvent *) event
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:_alphabetBackgroundImageView];
if((location.x > 50 && location.x < _alphabetBackgroundImageView.frame.size.width-50) && (location.y > 50 && location.y < _alphabetBackgroundImageView.frame.size.height-50))
UIImageView *lineImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 70, 70)];
lineImageView.center = location;
lineImageView.backgroundColor = selectedColor;
[_alphabetBackgroundImageView addSubview:lineImageView];
- (void) touchesMoved:(NSSet *) touches withEvent:(UIEvent *) event
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:_alphabetBackgroundImageView];
if((location.x > 50 && location.x < _alphabetBackgroundImageView.frame.size.width-50) && (location.y > 50 && location.y < _alphabetBackgroundImageView.frame.size.height-50))
UIImageView *lineImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 70, 70)];
lineImageView.center = location;
lineImageView.backgroundColor = selectedColor;
[_alphabetBackgroundImageView addSubview:lineImageView];
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:_alphabetBackgroundImageView];
if((location.x > 50 && location.x < _alphabetBackgroundImageView.frame.size.width-50) && (location.y > 50 && location.y < _alphabetBackgroundImageView .frame.size.height-50))
UIImageView *lineImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 70, 70)];
lineImageView.center = location;
lineImageView.backgroundColor = selectedColor;
[_alphabetBackgroundImageView addSubview:lineImageView];
IN .h file:
@property (strong, nonatomic) IBOutlet UIImageView *alphabetBackgroundImageView;
In .m file:-
alphabetsStoreArray = [[NSMutableArray alloc]initWithObjects:@"write a.png",@"write b.png",@"write c.png",@"write d.png",@"write e.png",@"write f.png",@"write g.png",@"write h.png",@"write i.png",@"write j.png",@"write k.png",@"write l.png",@"write m.png",@"write n.png",@"write o.png",@"write p.png",@"write q.png",@"write r.png",@"write s.png",@"write t.png",@"write u.png",@"write v.png",@"write w.png",@"write x.png",@"write y.png",@"write z.png", nil];
selectedColor = [UIColor colorWithRed:181/255.0 green:218/255.0 blue:234/255.0 alpha:1.0];
I have used two UIImageView AND this 2 images are placed on the same location .location at:-x=492.5;y=323;width=500;height=500.
one image to display the image and other to change the image.
The image displaying is letters from A-Z.
I have used UITouch event.So when the letter displaying i call the touch event.To display the next letter .
I have used a button to show the next.So when i click the next button the letter will change.
i have used colour as named selectedColor in code.so i can fill the colour in the letter.
But i need to the condition that if the colour fully not filled then show alert.HOW TO DO?
[ad_2]
لینک منبع