zoukankan      html  css  js  c++  java
  • iphone开发常见问题小集2 HA


    1.莫名碰到[[[Class alloc] init] autorelease] 调用时执行 -(id)initWithFrame:(CGRect)frame 

     原因:没有 重载init方法,就默认执行 重载的frame方法 

    2.UISerachBar 去除背景框

    for (UIView *subview in searchBar.subviews) {
       
    if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")]) {
           
    [subview removeFromSuperview];
           
    break;
       
    }

    } 

    3.响应键盘search事件{UITextFiled等同理}

    - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{

    } 

    4.NSSelectorFromString使用

    SEL blackSel = NSSelectorFromString(@"blackColor");

    if ([UIColor respondsToSelector: blackSel])

    self.view.backgroundColor  = [UIColor performSelector:blackSel]; 

    5.图片边拉伸

    - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight

     6.能正确获取当前设备方向的方法{在ViewController里}

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

  • 相关阅读:
    列表和元组
    UVM宏
    UVM中重要函数
    组合模式(composite)
    装饰器模式(Decorator)
    适配器模式(Adapter)
    桥接模式
    原型模式(prototype)
    单例模式(singleton)
    UML类图
  • 原文地址:https://www.cnblogs.com/halou/p/1992257.html
Copyright © 2011-2022 走看看