posted by dalnimbest 2013. 9. 24. 22:52
  • 버튼이 파란색으로 나오면...xib에서 버튼의 type을 system이 아닌 custom으로 바꾸어 준다.


  • 화면이 위로 밀려올라가 보일때
    if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }



  • status bar를 표시 안하기

Ready2Read-Info.plist에서 View controller-based status bar appearance를 추가하고 NO로 둔다.



  • alertview에 textfield가 표시안될때

   if ([myCommon getIOSVersion] >= IOSVersion_7_0) {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"FileName", @"")
                                                        message:@"" // 중요!! 칸을 내려주는 역할을 합니다.
                                                       delegate:self
                                              cancelButtonTitle:NSLocalizedString(@"Cancel", @"")
                                              otherButtonTitles:NSLocalizedString(@"OK", @""), nil];
       
        alert.tag = 1;

        alert.alertViewStyle = UIAlertViewStylePlainTextInput;

        UITextField *txtFldBookNameLocal = [alert textFieldAtIndex:0];
        txtFldBookNameLocal.autocapitalizationType = UITextAutocapitalizationTypeNone;
        txtFldBookNameLocal.clearButtonMode = UITextFieldViewModeWhileEditing;
        txtFldBookNameLocal.backgroundColor = [UIColor whiteColor];
        txtFldBookNameLocal.text =[NSString stringWithFormat:@"%@_%@.txt", strYearMonthDay, strHourMinute];
        txtFldBookNameLocal.keyboardType = UIKeyboardTypeDefault;
       
        CGAffineTransform moveUp = CGAffineTransformMakeTranslation(0.0, 0.0);
        [alert setTransform: moveUp];
        [alert show];
        [alert release];
    } else {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"FileName", @"")
                                                        message:@"\n\n" // 중요!! 칸을 내려주는 역할을 합니다.          
                                                       delegate:self                                
                                              cancelButtonTitle:NSLocalizedString(@"Cancel", @"")      
                                              otherButtonTitles:NSLocalizedString(@"OK", @""), nil];
       
        alert.tag = 1;   
        txtFldBookName.text = @"텍스트";
        [alert addSubview:txtFldBookName];    
        [alert show];   
        [alert release];
    }
   


* tableview의 특정 컨트롤이 속한 cell을 가져오기

ios7부터는 중간에 UITableViewCellScrollView이 하나 더 있기 때문에 superview를 한번더 불러야 한다.

Using iOS 6.1 SDK

  1. <UITableViewCell>
  2.    | <UITableViewCellContentView>
  3.    |    | <UILabel>

Using iOS 7 SDK

  1. <UITableViewCell>
  2.    | <UITableViewCellScrollView>
  3.    |    | <UIButton>
  4.    |    |    | <UIImageView>
  5.    |    | <UITableViewCellContentView>
  6.    |    |    | <UILabel>


    NSString *strTemp = @"";
    NSIndexPath *indexPath;
    if ([myCommon getIOSVersion] >= IOSVersion_7_0) {
        UITableViewCell *cell = (UITableViewCell *)[[[sender superview] superview] superview];
        indexPath = [tblViewMain indexPathForCell:cell];
    } else {
        indexPath = [tblViewMain indexPathForCell:(UITableViewCell *)[[sender superview] superview]];
    }

    //현재선택한 셀의 줄을 가져온다.
//    NSIndexPath *indexPath = [tblViewMain indexPathForCell:(UITableViewCell *)[[sender superview] superview]];
    strTemp     = [[self.arrDicSetting    objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];