我想知道我们如何单独使用单一(x或y)方向UIPinchGestureRecognizer进行缩放UIView.比如,如果用户仅在单个方向(水平)上以捏合手势移动他的两个手指,则仅uiview的宽度应该增加/减小,并且如果手指仅垂直移动,则高度应该改变.如果手指沿对角线移动,则uiview的高度和宽度都应增加/减少.我看过Apple的MoveMe示例代码.
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(scalePiece:)];
[pinchGesture setDelegate:self];
[piece addGestureRecognizer:pinchGesture];
[pinchGesture release];
Run Code Online (Sandbox Code Playgroud)
比例片:
- (void)scalePiece:(UIPinchGestureRecognizer *)gestureRecognizer
{
UIView *piece = (UIView *) [gestureRecognizer view];
NSLog(@"scalePiece enter");
if ([gestureRecognizer state] == UIGestureRecognizerStateBegan){
NSLog(@"inside if");
lastTouchPosition = [gestureRecognizer locationInView:piece];
}
else if ([gestureRecognizer state] == UIGestureRecognizerStateBegan || [gestureRecognizer state] == UIGestureRecognizerStateChanged){
NSLog(@"inside else");
CGPoint currentTouchLocation = [gestureRecognizer locationInView:piece];
NSLog(@"currentTouchLocation = %@ and lastTouchPosition= %@",NSStringFromCGPoint(currentTouchLocation), NSStringFromCGPoint(lastTouchPosition));
CGPoint deltaMove = [self calculatePointDistancewithPoint1:currentTouchLocation andPoint2:lastTouchPosition];
NSLog(@"deltaMove = %@",NSStringFromCGPoint(deltaMove));
float distance …Run Code Online (Sandbox Code Playgroud) 我想在我的应用程序中创建网格线方法,并允许用户打开/关闭网格视图。它不需要任何类型的触摸检测或与之相关的逻辑。只是网格线供用户查看并打开/关闭它们。显而易见的解决方案是将网格图像添加到我的视图中,并在需要时使用图像视图显示它。但这是我不能接受的选择。我必须以编程方式完成它。谢谢你的时间。我计划实施的图像。有任何想法吗 ?核心显卡还是很多 uiview?
这让我今天疯了,我已经使用了ASIHTTPRequest,http: //allseeing-i.com/,但是现在,我正在尝试将它添加到应用程序中,一旦添加它就给了我这个疯狂的错误.
我已经开始了一个新的项目,并评论了所有相关的代码,添加了没有它的代码,是的,它工作,添加它,它的库,没有它不起作用,我得到这个疯狂错误,我卡住了并需要帮助.
顺便说一下,这是详细的错误,
ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/libz.1.2.3.dylib, missing required architecture i386 in file
ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/libSystem.dylib, missing required architecture i386 in file
ld: in /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0/Symbols/usr/lib/libobjc.A.dylib, missing required architecture i386 in file for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
Run Code Online (Sandbox Code Playgroud)
谢谢,问候,艾哈迈德
好的,所以我正在尝试使用两个视图的pagescrollView,每个视图都有一个不同的视图控制器,这样我就可以处理每个不同的视图.我得到了苹果的示例代码,看起来他们创建了很多不同的视图"懒得像他们说的那样"如何改变这些代码,以便我可以让第一页成为一个视图控制器而第二页是另一个视图控制器?
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// view controllers are created lazily
// in the meantime, load the array with placeholders which will be replaced on demand
NSMutableArray *controllers = [[NSMutableArray alloc] init];
for (unsigned i = 0; i < kNumberOfPages; i++) {
[controllers addObject:[NSNull null]];
}
self.viewControllers = controllers;
[controllers release];
// a page is the width of the scroll view
scrollView.pagingEnabled = YES;
scrollView.contentSize = CGSizeMake(scrollView.frame.size.width * kNumberOfPages, scrollView.frame.size.height);
scrollView.showsHorizontalScrollIndicator = NO;
scrollView.showsVerticalScrollIndicator = NO;
scrollView.scrollsToTop = NO;
scrollView.delegate …Run Code Online (Sandbox Code Playgroud) 我希望我的应用程序的轮换固定为景观......
我做了一些研究,但大多数帖子都是关于检测变化,
我找不到任何关于强迫一个人的事.
谁能帮助我?
我使用日期格式化程序字符串,以获取当前日期,如下所示:
NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
dateFormatter.dateFormat = @"EEEE / dd-MM-yyyy";
timeLabel.text = [dateFormatter stringFromDate:[NSDate date]];
Run Code Online (Sandbox Code Playgroud)
现在我需要在按下按钮时将日期减1,如果今天的日期是星期五/ 05-08-2011,那么按下按钮它应该显示星期四/ 04-08-2011.我怎样才能实现这一目标?
iphone ×5
ios ×2
ipad ×2
objective-c ×2
uiview ×2
autorotate ×1
grid ×1
ios4 ×1
uiscrollview ×1
xcode ×1