小编Joh*_*ato的帖子

UIView关闭Touch事件的方式

有没有办法关闭使用UIView类的触摸事件?我正在寻找班级参考,但似乎没有任何结果.

iphone cocoa-touch uiview ipad

3
推荐指数
1
解决办法
5126
查看次数

iphone setAnimationWillStartSelector/setAnimationDidStopSelector不工作(滚动代码示例)

我正在以水平滚动视图的形式在视图的底部(想想新闻频道的标题标题栏)显示一个自动收报机.当我将repeatCount设置为无限时,它可以正常工作,但我想在动画启动和停止时能够做一些其他功能.但是,在网上阅读了文档和很多例子后,我无法得到setAnimationWillStartSelector/setAnimationDidStopSelector来响应.

这是我的代码:

- (void)animateView {    
[UIScrollView setAnimationDelegate:self];    
[UIScrollView setAnimationWillStartSelector:@selector(animationStart:context:)];    
[UIScrollView setAnimationDidStopSelector:@selector(animationStop:finished:context:)];    
[UIScrollView beginAnimations:@"pan" context:nil];    
[UIScrollView setAnimationDuration:10.0f];    
[UIView setAnimationRepeatCount:1];    
[UIView setAnimationBeginsFromCurrentState:YES];    
[UIScrollView setAnimationCurve:UIViewAnimationCurveLinear];    
tickerScrollView.contentOffset = CGPointMake(textLabelRect.size.width,0);    
[UIScrollView commitAnimations];    
}    
- (void)animationStart:(NSString *)animationID context:(void *)context {    
NSLog(@"animationWillStart");    
}
- (void)animationStop:(NSString *)animationID finished:(BOOL)finished context:(void *)context {    
NSLog(@"animationDidStop");    
[self animateView];    
}
Run Code Online (Sandbox Code Playgroud)

目前,此代码位于我的UIViewController子类中.但是,我也尝试将它全部放在我的app委托中,同时也明显改变了setAnimationDelegate.我尝试过使用各种animationDurations,repeatCounts等,但仍然没有运气.

非常感谢任何帮助.谢谢

iphone uiscrollview

2
推荐指数
1
解决办法
4881
查看次数

如何分配initWithCoder或initWithFrame

    #import "DotAnimation.h"


@implementation DotAnimation
DoodlePad* dp;

-(void)setupView {
    Ball = CGRectMake(10, 10, 10, 10);
    [NSTimer scheduledTimerWithTimeInterval:(1.0f / 30.0f) target:self selector:@selector(traceBall) userInfo:nil repeats:YES];
}

-(id)initWithCoder:(NSCoder *)aDecoder {
    if (self == [super initWithCoder:aDecoder]){
        [self setupView];
    }
    return self;
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupView];
    }
    return self;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.*/
- (void)drawRect:(CGRect)rect {
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, …
Run Code Online (Sandbox Code Playgroud)

cocoa objective-c

2
推荐指数
1
解决办法
4803
查看次数

如何使用CSS制作分页的滑块圈?

我正在使用Slider,我需要像这样进行分页:

在此输入图像描述

我将使用CSS精灵图像,但我只是想知道是否可以使用CSS3并且不使用图像

我想要用于此的HTML包括:

<ol id="pagination">
<li><a href="#slide1" class="active">1</a></li>
<li><a href="#slide2">2</a></li>
<li><a href="#slide3">3</a></li>
<li><a href="#slide4">4</a></li>
<li><a href="#slide5">5</a></li>
</ol>
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/danVW/

css3

2
推荐指数
1
解决办法
8548
查看次数

删除UIView动画加速

如何删除UIView动画的加速和减速动画?

如果你不明白我的意思,当动画启动它会加速,然后当它到达结束时,它会减速.我希望动画是一个恒定的速度.这是我的代码看起来像的一个例子(我必须使用旧的动画方式).

-(void)animate:(NSString*)animationID finished:(BOOL)finished context:(void*)context {         
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationDidStopSelector:@selector(animateStop:finished:context:)];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:3];
    Motion.center = (*PathPoints)[Location];
    [UIView commitAnimations];        
}
Run Code Online (Sandbox Code Playgroud)

uiview uiviewanimation ios

1
推荐指数
1
解决办法
1633
查看次数

在UIToolBar上添加按钮(按代码)

如何通过按钮上的代码添加到我拥有该属性的工具栏?

@property (strong, nonatomic) IBOutlet UIToolbar *toolB;
Run Code Online (Sandbox Code Playgroud)

objective-c xcode4

1
推荐指数
1
解决办法
1万
查看次数

self/class 中的全局名称?

我在班级中调用变量时遇到问题。我已将所有内容都设置为自己的内容,但我仍然遇到错误。我想我很难弄清楚这一点,因为我是 3.0 脚本的新手。

这是我的脚本:

http://pastebin.com/9Lrw399E

这是错误:

command = 'tcpdump -c5 -tttt -w {0} host {1}'.format(raw, input_host)
NameError: global name 'raw' is not defined
Run Code Online (Sandbox Code Playgroud)

如果我让它们 self.raw 或 self.input_host

它得到这个:

command = 'tcpdump -c5 -tttt -w {0} host {1}'.format(self.raw, self.input_host)
AttributeError: 'MainLoop' object has no attribute 'raw'
Run Code Online (Sandbox Code Playgroud)

python subprocess

0
推荐指数
1
解决办法
452
查看次数

通过iOS在没有App Open(或在后台)的情况下通过BLE同步数据

我正在研究一种在门关闭时保持计数的设备.我想要做的是当我走进门时,我的iPhone会自动同步设备上的数据并将该计数发送到服务器(通过iPhone),而无需打开应用程序或将其置于后台.这有可能,如果是这样的话怎么样?

这是我正在思考的图表:

门关闭 - > BLE通知iPhone - > BLE向iPhone发送计数 - > iPhone将该值发送给服务器

所有没有用户(我)触摸我的设备或打开已安装的iOS应用程序.

ios core-bluetooth bluetooth-lowenergy ibeacon

0
推荐指数
1
解决办法
880
查看次数