scrollviewDelegate method를 선언해준뒤


 - (void)scrollViewDidEndDragging:(UIScrollView *)aScrollView

                  willDecelerate:(BOOL)decelerate

{

 

    if((int)aScrollView.tag == 1200){ // 데이터 불러올 테이블뷰 지정

     

    }else{


        CGPoint offset = aScrollView.contentOffset;

        CGRect bounds = aScrollView.bounds;

        CGSize size = aScrollView.contentSize;

        UIEdgeInsets inset = aScrollView.contentInset;

        float y = offset.y + bounds.size.height - inset.bottom;

        float h = size.height;

        

        float reload_distance = 50;

        if(y > h + reload_distance) {

            NSLog(@"load more rows");

       }

    }

}


'ios 개발' 카테고리의 다른 글

ios objective c tableview delegate method  (0) 2017.08.21
[ios] UItabbarController 관련 메서드  (0) 2017.07.12
[ios] plist 읽어오기 및 쓰기  (0) 2017.07.10
[arcjeen] 1. ios UILabel  (0) 2017.03.14

WRITTEN BY
arcjeen
ios 관련문의 slimforce@naver.com

,





- (
void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

//셀 선택시 실행될 메서드

}


-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

//셀 높이 설정


}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

//셀 갯수 설정

}


//

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

    //custom cell define

        

        NSString *CellIdentifier = [NSString stringWithFormat:@"S%dR%da",(int)indexPath.section,(int)indexPath.row];

        //셀 구분자 설정

        RankListTableViewCell *cell = (RankListTableViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if(cell == nil){

            cell = [[RankListTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

          //cell 컨텐츠 설정 

          

        }

    

        return cell;

    



WRITTEN BY
arcjeen
ios 관련문의 slimforce@naver.com

,


2
.UItabbarContoller


//탭 아이템 글자 색깔 지정

[UITabBarItem.appearance setTitleTextAttributes:

@{NSForegroundColorAttributeName : [UIColor whiteColor]} forState:UIControlStateNormal];

 

[UITabBarItem.appearance setTitleTextAttributes:

     @{NSForegroundColorAttributeName : [UIColor colorWithRed:0/255.0f green: 162/255.0f blue:154/255.0f alpha:1.0]}

                                           forState:UIControlStateSelected];

if ([[[UIDevice currentDevicesystemVersionfloatValue] >= 7) {

        for (UITabBarItem *tbi in self.tabBarController.tabBar.items) {

            tbi.image = [tbi.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];

        }

}



}


//탭 초기화



UINavigationController
 *mainNavCon = [[UINavigationController alloc]initWithRootViewController:mainView];

    [mainNavCon popViewControllerAnimated:YES];

    mainNavCon.navigationBarHidden = YES;

       

    

    UIImage *homeImg = [UIImage imageNamed:@"icon_home"];

       

    mainNavCon.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"" image:homeImg tag:0];

      

    tabBarController.viewControllers = @[mainNavCon,myVocaNavCon, recentNavCon, GroupNavCon, settingNavCon];

    //탭 백그라운드이미지설정

    [[UITabBar appearancesetBackgroundImage:[UIImageimageNamed:@"bar_menu"]];

    

    tabBarController.tabBar.translucent = true// 탭바투명도 설정

    

[[UITabBar appearance]setTintColor:[UIColor colorWithRed:0/255.0f green:162/255.0f blue:154/255.0f alpha:1.0]];

  

[[UITabBar appearancesetSelectionIndicatorImage:[UIImage imageNamed:@“icon_cover"]]; //탭 선택시 인디케이트 이미지


//탭선택하기


self.tabBarController.selectedIndex = 0;



WRITTEN BY
arcjeen
ios 관련문의 slimforce@naver.com

,



//plist 불러오기

NSFileManager *fileManager = [NSFileManager defaultManager];


NSError *error;


NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, 

NSUserDomainMask, YES);

    

plistPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"userPlist.plist"];

    

    successPlist = [fileManager fileExistsAtPath:plistPath];

    if(!successPlist){

       

//file does not exist. So look into mainBundle

        NSString *defaultPath = [[[NSBundle mainBundle] resourcePath]    stringByAppendingPathComponent:@"userPlist.plist"];

        successPlist = [fileManager copyItemAtPath:defaultPath toPath:plistPath error:&error];

    }

    //plist객체

plistDict =[[NSMutableDictionary alloc]initWithContentsOfFile:plistPath];


//plist 쓰기

NSMutableDictionary *infoDict = [[NSMutableDictionary alloc]initWithContentsOfFile:plistPath];

    [infoDict setObject:@"1" forKey:@"login_type"];

    [infoDict writeToFile:plistPath atomically:YES];



WRITTEN BY
arcjeen
ios 관련문의 slimforce@naver.com

,

1. ios UILabel


- ios sdk에서 사용되는 가장 기본적인 클래스중 하나. 어플리케이션내에서 표현되는     짧은 텍스트 들은 대부분 UILabel에 담겨져서 표현된다.

 

 - 샘플코드

<헤더파일에 UILabel *testLabel; 선언 후 사용>


<실행화면>



CGPoint screenSize = CGPointMake([[UIScreen mainScreen]bounds].size.width, [[UIScreen mainScreen]bounds].size.height);


CGPoint는 2차원 배열의 형태로 보통 좌표값을 저장하는데 사용해요.

CGpoint 구조체의 생성은 CGPointMake라는 클래스로 하게되는데


UIScreen 클래스의 mainScreen함수는 사용자 디바이스의 스크린 정보를 가져를 가져오게 되는데 여기서 bounds함수로 디바이스의 크기를 가져올수 있습니다.



// uilabel 프레임 크기 지정

    testLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 300, 200)];


    // view 상에서의 uilabel 중심 좌표 지정

    testLabel.center = CGPointMake(screenSize.x/2, screenSize.y/2);


    // uilabel 배경색 지정

    [testLabel setBackgroundColor: [UIColor grayColor]];


    // uilabel textcolor 지정

    [testLabel setTextColor:[UIColor whiteColor]];


    // uilabel 내용 지정

    [testLabel setText:@"테스트라벨"];


    // 시스템폰트 이외의 다른 폰트를 사용할 해당되는 폰트이름을 fontname 작성한다

    //    [testLabel setFont:[UIFont fontWithName:@"fontname" size:14.f]];


    // 라벨내의 텍스트 정렬 방식

    [testLabel setTextAlignment:NSTextAlignmentCenter];


    // 기본 시스템폰트사용시 글자 크기 변경

    [testLabel setFont:[UIFont systemFontOfSize:12.0f]];


     //메인뷰에 테스트 라벨 추가.

    [self.view addSubview:testLabel];




UILabel은 가장 기본적은 UI 요소 이면서도 가장 많이쓰이는 요소이기도 한 만큼

활용도가 무궁 무진 합니다.

UIanimation을 이용한 여러가지 애니메이션 효과를 적용하면 보다 동적인 UI/UX 디자인을하실 수 있습니다.




WRITTEN BY
arcjeen
ios 관련문의 slimforce@naver.com

,