小编tka*_*kic的帖子

Xcode 4.2 - 在此功能警告之外不会显示'...'的声明

我使用Apple Sample Reachability中的 Apple Reachability类

在Xcode 4.2和新的Apple 3.0编译器中,我在这个类中得到警告

+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
Run Code Online (Sandbox Code Playgroud)

'struct sockaddr_in '的声明在此函数之外将不可见*

我不擅长经典C%)所以我不明白我怎么能解决这个警告,或者可能是我可以忽略它.

谢谢

iphone ios xcode4 ios5

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

源类型1不可用

我有一个适用于iPhone和iPad的应用程序,当我尝试加载UIPickerViewController一个UIPopoverController用于iPad,我得到了异常"源类型1不可用".即使使用该设备也会出现问题.

@try {
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])  {
        UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

        imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagePicker.delegate = self;
        imagePicker.allowsEditing = NO;

        self.tempComp = component;
        if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
            [self presentModalViewController:imagePicker animated:YES];
        }else {
            // We are using an iPad
            popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePicker];
            popoverController.delegate = self;

            [popoverController presentPopoverFromRect:component.bounds inView:component permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
        }
    }else{
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Camera Non Disponibile" message:@"La camera non è disponibile" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
        [alert show];
    } …
Run Code Online (Sandbox Code Playgroud)

uipickerview uipickerviewcontroller ipad uipopovercontroller ios

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

用于UICollectionView的SectionIndexTitles

所以我TableView用搜索功能实现了一个正确的sectionIndexTitles.现在,我正在尝试实现一个UICollectionView它到目前为止工作,除了我不能轻易拥有sectionIndexTitles(右滚动条).

如果我查看Facebook应用程序,它看起来像一个UICollectionView,但确实sectionIndexTitles和一个搜索栏.我似乎无法为UICollectionView模型找到这样的功能.

有任何想法吗?!

谢谢!

在此输入图像描述

ios ios5 ios6 uicollectionview

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

Swift:如何在执行触摸操作时禁用用户交互?

我正在使用精灵工具包,如果用户触摸屏幕,其中的操作

override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
    /* Called when a touch begins */

    for touch: AnyObject in touches {
    }
}
Run Code Online (Sandbox Code Playgroud)

进行了.但是,当他们执行时,用户仍然可以点按屏幕,应用程序会尝试再次运行操作.

如何在操作运行时禁用触摸交互/触摸功能中的操作?

swift

21
推荐指数
3
解决办法
4万
查看次数

Spring:客户端发送的请求在语法上是不正确的()

嗨我在重定向期间收到了下一个错误:

客户端发送的请求在语法上是不正确的

浏览器显示的URL是:localhost:8080/Project/menu/main/home/0这里我的类首先重定向 - "从",第二个"到":

 /*
 * Get all possible values of menu and generate correct url to pages controllers
 * 
 */

@Controller
@SessionAttributes("menu")
public class MainMenuController {


    @ModelAttribute
    public Menu createMenu() {
        return new Menu();
    }

    @RequestMapping(value = "/menu", method = RequestMethod.GET)
    public String mainMenuResolver(@ModelAttribute Menu menu) {
        menu.setMainMenu("first");
        return "forward:/menu/first";
    }

    @RequestMapping(value = "/menu/{mainMenu}", method = RequestMethod.GET)
    public String subMenuResolver(@PathVariable String mainMenu, @ModelAttribute Menu menu) {
        menu.setMainMenu(mainMenu);
        menu.setSubMenu("home");
        return "forward:/menu/first/home";
    }

    @RequestMapping(value = "/menu/{mainMenu}/{subMenu}", method = …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc

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

检测UIScrollView是否正在滚动

我想要检测a是否(不是何时)UIScrollView滚动.

BOOL isScrolling = myscrollview.scrolling;
Run Code Online (Sandbox Code Playgroud)

我将如何实现这一目标?.dragging并且.decelerating在使用时不适用setContentOffset:animated:.

ios

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

在单元格上设置角半径会导致UICollectionView的性能下降

我有一个UICollectionView只有几个细胞(约20).这个系列的性能非常好.但是,一旦我尝试围绕UICollectionViewCells这个视图呈现的角落,我的表现就会受到重创.在我的cell的init方法中,这是我添加的唯一一行导致这个:

[self.layer setCornerRadius:15];
Run Code Online (Sandbox Code Playgroud)

由于这是在init方法中,我正在重新使用单元格,我不明白为什么这应该导致我的问题.

我尝试使用以下多种组合来调整销售的光栅化和不透明度,但仍然没有效果:

[self.layer setMasksToBounds:YES];
[self.layer setCornerRadius:15];
[self.layer setRasterizationScale:[[UIScreen mainScreen] scale]];
self.layer.shouldRasterize = YES;
self.layer.opaque = YES;
Run Code Online (Sandbox Code Playgroud)

他们的一些设置或技巧是为了改善UICollectionView具有圆角的单元格的性能吗?

ios uicollectionview uicollectionviewcell

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

由于未捕获的异常'CALayerInvalidGeometry'终止应用程序,原因:'CALayer bounds包含NaN:[0 nan; 280 524]'

我正在开发一个书籍应用程序,用户可以在TextView上更改字体大小.

当用户更改字体大小时,应用程序会保存当前文本位置,以便在用户更改字体大小后不更改该位置.

它在大多数情况下工作正常,但有时,当用户更改字体大小时,应用程序会出现此类错误,我仍然无法告诉如何解决此问题.

由于未捕获的异常'CALayerInvalidGeometry'终止应用程序,原因:'CALayer bounds包含NaN:[0 nan; 280 524]" *第一掷调用堆栈:(0x3231e3e7 0x3a019963 0x3231e307 0x33edb4d7 0x33edb30d 0x3419141f 0x3419b82f 0x342d1cf1 0x3414f80d 0xe7bf1 0xe607d 0xfad35 0x34218087 0x34218111 0x34218087 0x3421803b 0x34218015 0x342178cb 0x34217db9 0x341405f9 0x3412d8e1 0x3412d1ef 0x35e455f7 0x35e45227 0x322f33e7 0x322f338b 0x322f220f 0x3226523d 0x322650c9 0x35e4433b 0x341812b9 0xdf9f1 0xdf978)的libc ++ ABI. dylib:终止调用抛出异常

我也无法100%重现此问题,因为这个问题偶尔会发生.

这是代码.有人有想法解决这个问题吗?提前致谢.

- (UITextRange *)getCurrentTextRange:(UITextView *)textView {

    CGRect bounds               = textView.bounds;
    UITextPosition *start       = [textView characterRangeAtPoint:bounds.origin].start;
    UITextPosition *end         = [textView positionFromPosition:start offset:1];
    UITextRange *textRange      = [textView textRangeFromPosition:start toPosition:end];

    return textRange;
}

- (void)changeFontSize:(UIButton*)button {

    UITextRange …
Run Code Online (Sandbox Code Playgroud)

iphone crash calayer ios

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

UICollectionView:断言失败 - [UICollectionView _endItemAnimations]

我在我的应用中收到此错误:

***断言失败-[UICollectionView _endItemAnimations],/ SourceCache/UIKit/UIKit-2372/UICollectionView.m:2801

它出现在我的-controllerDidChangeContent:方法中:

[self.collectionView performBatchUpdates:^{...}];
Run Code Online (Sandbox Code Playgroud)

有谁知道是什么原因造成的?我的代码基于https://gist.github.com/4440c1cba83318e276bb,我很茫然.

谢谢!

assertions ipad ios ios6 uicollectionview

11
推荐指数
2
解决办法
7065
查看次数

返回不可变对象的首选方法

如果我有一个看起来像这样的方法:

- (NSDictionary *)removeDataInDictionary:(NSDictionary *)dictionary {

    NSMutableDictionary *mutableDictionary = [dictionary mutableCopy];
    [mutableDictionary removeObjectForKey:@"key"];

    // Return option 1
    return [NSDictionary dictionaryWithDictionary:mutableDictionary];

    // Return option 2
    return (NSDictionary *) mutableDictionary;
}
Run Code Online (Sandbox Code Playgroud)

选项1是否"更好"代码化,因为它真的会返回一个while NSDictionary选项2实际上会NSMutableDictionary伪装成一个NSDictionary

types objective-c mutable immutability

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