我正在UIAlertView使用文本输入.
UIAlertView *alertView=[[UIAlertView alloc]initWithTitle:@"Save" message:@"Please Enter the Name of PDF" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
[alertView setAlertViewStyle:UIAlertViewStylePlainTextInput]
Run Code Online (Sandbox Code Playgroud)
当UITextField为空时我想做什么我禁用带有委托功能的OK按钮
- (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView
{
return NO;
}
Run Code Online (Sandbox Code Playgroud)
当用户开始在文本字段中写入内容时,应该启用"确定"按钮.
在iOS 6中,我使用此代码来获取以下行中的行数UITextView:
int numLines = textView.contentSize.height / textView.font.lineHeight;
Run Code Online (Sandbox Code Playgroud)
但这在iOS 7中不起作用.如何获得iOS 7中UITextView的总行数?
我试图使用api sortedArrayUsingComparator对一个带有2个数字的对象进行排序
array1= [array sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
person *p1 = (person*)obj1;
person *p2 = (person*)obj2;
if (p1.value>p2.value && p1.age>p2.age)
{
return (NSComparisonResult)NSOrderedAscending;
}
else
return (NSComparisonResult)NSOrderedDescending;
}];
Run Code Online (Sandbox Code Playgroud)
我想让代码排序这样的东西,,,,
input : 0 1
1 2
0 9
1 4
2 3
output: 0 1
0 9
1 2
1 4
2 3
Run Code Online (Sandbox Code Playgroud)