当我们按下文本字段时,光标会出现在此文本字段中; 但我不希望这个光标出现; 那么我想让这个文本域禁用,你不能在里面写,我该怎么办?
我有一个UIImage,我希望在3秒后将其alpha设置为0.00 ...在我的UIImage中有一张我希望在进入视图时立即看到的图片,但是在3秒后它必须消失.
我想知道在白色视图中用手指画线的方法是什么.我想做一个画板,我想开始理解用手指画出一条简单的线条或一条轨道.我该怎么做?
我有三个viewController
第一,第二和第三
从第二到第三我用
Third *third = [[Third alloc]initWithNibName:@"Third" bundle:nil];
[self presentModalViewController:third animated:YES];
[third release];
Run Code Online (Sandbox Code Playgroud)
现在我想从第三到第一回来; 然后我在第二个代码中设置viewDidAppear:
[self dismissModalViewControllerAnimated:NO];
Run Code Online (Sandbox Code Playgroud)
但是1秒钟我看到第二个,我不想看它......我该怎么办?
我有这个代码:
translateRight("iv1"); //iv1 is an id of an imageView
private void translateRight(String st){
ImageView img = (ImageView)findViewById(R.id.st);
Animation a = AnimationUtils.loadAnimation(this, R.anim.translate_right);
img.startAnimation(a);
}
Run Code Online (Sandbox Code Playgroud)
我有"translateRight"这是一个显示动画的方法,但在这种方法中我应该传递一个资源ID; 我尝试了一个字符串,但它不起作用,我该怎么办?
在我的应用程序中,我需要在屏幕上捕获确切的手指数量,我尝试两种方式,但我有2个不同的问题.
第一种方式:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
NSArray *allTouches = [touches allObjects];
int count = [allTouches count];
NSLog(@"number of touch:%d", count);
}
Run Code Online (Sandbox Code Playgroud)
如果我同时使用更多手指,这会给我一个不准确的触摸次数.
第二种方式:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
int num = [touches count];
totalTouch = totalTouch+num;
NSLog(@"number of touch:%d", totalTouch);
}
Run Code Online (Sandbox Code Playgroud)
通过这种方式,我使用了一个全局var(totalTouch),每次调用touchbegan时我都会增加它,并且我有完美的触摸次数.当然,我在touchend中设置为'0'这个变量
- (void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
totalTouch = 0;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,通过第二种方式我在touchbegan中进行控制,这个:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
int num = [touches count];
totalTouch = totalTouch+num;
if (totalTouch == numberToVerify){
//IT ENTER HERE EVERYTIME INSIDE THIS …
Run Code Online (Sandbox Code Playgroud) 我必须验证字符串的开头:我的示例字符串是
NSString *string1 = @"Hello World";
Run Code Online (Sandbox Code Playgroud)
然后我必须做一个if,例如:
if (string1 startwith "Hello")
Run Code Online (Sandbox Code Playgroud)
我怎么能在目标c中做到这一点?
我有一个带有png的ImageView,我想这样做:当有人触摸这个imageview时,它的alpha变为0.0,是否可能?(全部没有按钮)
有没有一种方法来验证NSString是否没有字符?没有字符的字符串示例可以是:
@""或@""或@"\n"或@"\n \n",我希望cosider这些字符串为空字符串并打印一个nslog,告诉我这些是emty,我应该使用什么样的控件?
我正在开发一个新的通用应用程序(最低iOS 7),我想使用Swift(这是我使用这种新语言的第二个应用程序).在这个应用程序中,我需要AFNetworking框架,但我对与新版本Alamofire的兼容性有一些疑问.我知道Alamofire和iOS 7之间存在一些问题.所以,你有什么建议?在这个项目中使用Alamofire还是继续使用AFNetworking?
ios ×8
xcode ×7
nsstring ×2
objective-c ×2
alamofire ×1
alpha ×1
android ×1
cursor ×1
dismiss ×1
drawing ×1
swift ×1
touch ×1
touchesbegan ×1
uiimage ×1
uiimageview ×1
uitextfield ×1