小编haz*_*zem的帖子

禁用UIAlertView按钮

我正在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)

当用户开始在文本字段中写入内容时,应该启用"确定"按钮.

cocoa-touch objective-c ios

12
推荐指数
2
解决办法
6611
查看次数

UITextView iOS 7的行数

在iOS 6中,我使用此代码来获取以下行中的行数UITextView:

int numLines = textView.contentSize.height / textView.font.lineHeight;
Run Code Online (Sandbox Code Playgroud)

但这在iOS 7中不起作用.如何获得iOS 7中UITextView的总行数?

objective-c ios ios7

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

sortedArrayUsingComparator在排序数组中包含具有2个数字的对象

我试图使用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)

ios

3
推荐指数
2
解决办法
6498
查看次数

标签 统计

ios ×3

objective-c ×2

cocoa-touch ×1

ios7 ×1