uitouch

Keyboard dismiss and UITableView touch issue

↘锁芯ラ 提交于 2019-12-08 09:54:52
问题 So I have this UITableView that contains few rows, when clicked on a row, another UIViewController is pushed with the specific row details. My problem is that I want to dismiss keyboard with any touch on the screen (also on the UITableView ), but when I do it, and click on the UITableView row, the keyboard dismisses, but the didSelectRow method is not working. It wont push the new ViewController once clicked on the cell. Also the other way around, once I change it, you can click on the

Simulating UITouch in xCode 4.5 programmatically (UISpec)

天大地大妈咪最大 提交于 2019-12-08 00:15:32
问题 I'm using UISpec for automated testing in my project. Everything was fine until Apple released xCode 4.5 with iOS 6 SDK. Now UISpec project can't be compiled because a list of errors in category of UITouch class. Here is the code: // // TouchSynthesis.m // SelfTesting // // Created by Matt Gallagher on 23/11/08. // Copyright 2008 Matt Gallagher. All rights reserved. // // Permission is given to use this source code file, free of charge, in any // project, commercial or otherwise, entirely at

Call another object's touches begin iOS

a 夏天 提交于 2019-12-07 13:00:16
问题 Lets say I have view1 which is intercepting touch events and view2 which is not. Can view1 pass those events to view2 and call [view2 touchesBegin] [view2 touchesMoved]...etc? 回答1: Yes, sometimes, maybe. The technique you're asking about is known as event forwarding . I'll refer you to the Forwarding Touch Events section of the Event Handling Guide for iOS, which says the following: The classes of the UIKit framework are not designed to receive touches that are not bound to them; in

how identify touch in a particular view

折月煮酒 提交于 2019-12-07 03:25:22
问题 How to get touch on a particular view. I am using CGPoint Location = [[touches anyObject] locationInView:self.view ]; but want to trigger the action only if an particular subView is clicked. How to do this. 回答1: I got the answer myself...but thanks other which helped me on this here it is UITouch *touch ; touch = [[event allTouches] anyObject]; if ([touch view] == necessarySubView) { //Do what ever you want } 回答2: Try this //here enable the touch - (void)touchesBegan:(NSSet *)touches

Comparing a UITouch location to UIImageView rectangle

邮差的信 提交于 2019-12-07 03:09:32
问题 I have the following code to determine if a touch is within an image view in my table cell. However, it doesn't work. I compared the two with CGRectContainsPoint however, it doesn't work. Here is the code: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { // Declare the touch and get it's location UITouch *touch = [touches anyObject]; CGPoint touchLocation = [touch locationInView:self]; if (CGRectContainsPoint(myImageView.frame, touchLocation)) { NSLog(@"Tapped image view"); }

UIView bringSubviewToFront: does *not* bring view to front

倾然丶 夕夏残阳落幕 提交于 2019-12-07 01:26:22
问题 I am implementing a simple iOS solitaire game that allows the user to drag the cards around in the usual way. The cards are represented with the UIView subclass CardView . All the card view's are siblings which are subviews of SolitaireView . The following snippet tries to "bring a card to the front" so that it is above all the other views as it is being dragged: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; if (touch.view.tag == CARD

UIControl Not Receiving Touches

允我心安 提交于 2019-12-06 18:35:12
问题 I have a UIControl which implements the touches began method like so: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; //More code goes here This subclass of UIControl is instantiated in a view controller, it is then added as a subview to that view controller. I have a breakpoint at the touches began method of the UIControl, and the method never gets called. I've been doing some reading and it seems that the View Controller has

UITableView doesn't scroll

不想你离开。 提交于 2019-12-06 12:26:32
问题 So, this is my view: and this is my UItableViewDelegate and DataSource -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 20; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"course"]; cell.textLabel.text = [NSString stringWithFormat:@"%i"

Propagating touch events through sibling subviews?

我怕爱的太早我们不能终老 提交于 2019-12-06 06:11:32
问题 I've got a stack of subviews that are all have user interactive sections (children) and all full screen. The problem is that, if I touch down on a non-interactive section at the top of the stack, it won't then propagate that touch across the rest of the stack. My setup: view A --view B (full screen container, not itself interactive but has interactive subviews) ----view B1 (interactive) ----view B2 (interactive) --view C (same as B) ----view C1 (interactive) ----view C2 (interactive) B and C

How to get rid of this “points” between my lines when I am drawing?

谁说我不能喝 提交于 2019-12-05 23:35:37
问题 is there an easy way to not draw this points in my lines? I don't know why this points are there because i never release my finger from screen during drawing of a line. I got the code from a drawing example. // draw a line - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { mouseSwiped = YES; UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch locationInView:self.view]; currentPoint.y -= 0; // 20 only for 'kCGLineCapRound' UIGraphicsBeginImageContext(self.view