在iOS 7中处理文本输入字段验证的适当方式是什么?有没有显示对话框的替代方案?
我对iOS应用程序没有多少经验(我更喜欢Android风扇),我希望它类似于android的:
mEditText.setError("Error string");
Run Code Online (Sandbox Code Playgroud)
我找到的最近的东西就是这个库,但是我想知道iOS中是否存在原生内容(如果可能的话,我想避免使用第三方库).
提前致谢.
嗨,我正在尝试一些示例和检查文档,但我不能让它工作.这是我的代码:
@interface AHMSoudView : UIView <UIInputViewAudioFeedback>
- (void) playClick;
@end
@implementation AHMSoudView
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
- (BOOL) enableInputClicksWhenVisible {
return YES;
}
- (void) playClick {
[[UIDevice currentDevice] playInputClick];
}
@end
Run Code Online (Sandbox Code Playgroud)
在故事板中,我将视图设置为我的AHMSoundView.在控制器中,我有:
- (IBAction)keypadTouchDown:(id)sender {
[((AHMSoudView *)self.view) playClick];
}
Run Code Online (Sandbox Code Playgroud)
但没有任何反应.我究竟做错了什么?
我很想在这里提问,所以任何有关这方面的建议都会受到赞赏......但是对于我的问题:
我正在尝试从一个活动切换到另一个活动,在那里我将显示来自服务器的一些数据.我通过AsyncTask从服务器提取数据,但是当下载时间较长时,活动之间会显示黑屏.我已经尝试将asyncTask从onCreate()放到onStart()但没有改变.
新活动:
public class SalesMenu extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.sales_menu);
setProgressBarIndeterminateVisibility(true);
super.onCreate(savedInstanceState);
}
@Override
protected void onStart() {
List<HashMap<String, Object>> result = null;
AsyncTask<Void, Boolean, List<HashMap<String, Object>>> aTask = new AsyncSearchRead(
"sale.order",
new Object[0],
new String[] {"name"},
this).execute();
try {
result = aTask.get();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
Log.d("test", (result!=null ? result.toString() : "nothing"));
super.onStart();
}
}
Run Code Online (Sandbox Code Playgroud)
我的AsyncTask:
public class AsyncSearchRead extends AsyncTask<Void, Boolean, List<HashMap<String, …Run Code Online (Sandbox Code Playgroud) android ×1
input ×1
ios ×1
ios7 ×1
objective-c ×1
progress-bar ×1
uitextfield ×1
validation ×1