'전체 글'에 해당되는 글 51건

  1. 2015.03.02 [MySQL] ORDER BY 명령어 다중 사용
  2. 2014.05.22 [ObjectC] Ios UILabel 세로정렬
  3. 2014.03.06 [ObjectC]ios View에 slide 효과 주기
2015. 3. 2. 11:22

Mysql 명령어 중 'ORDER BY' 라는 명령어는 정렬을 위한 명령어로 'DESC', 'ACS' 두개지 셋팅값을 주어 Example1) 과 같이 사용할 수 있다.


Example1) select writer_id from `board_posts` where upload_inning='1' ORDER BY referee_cnt DESC


"DESC" 명령어는 역방향의 정렬을 위한 명령어이며, "ASC" 명령어는 정방향의 정렬을 위한 명령어이다.

두개 이상의 정렬 기준을 셋팅하기 위해서는, Example2) 같은 방식으로 사용할 수 있다.


Example2) ORDER BY referee_cnt DESC, timestamp ASC


Example2) 와 같은 방식으로 사용하면, referee_cnt DESC 정렬 후, timestamp ASC 가 정렬된다. 즉 왼쪽부터 순차적으로 적용되어 정렬된다.


Posted by 은돌군
2014. 5. 22. 18:29

IOS 의 UILabel의 가로정렬은 아주 간단하게 가능하지만~


세로정렬은 기본적으로 제공하지 않는다.. (가로정렬처럼 align 때려박듯이 한방에 되었으면 좋겠다만)


덕분에 세로정렬을 위해서는 골을 좀 싸메야 한다.!


우선 UILabel의 SIze를 알아내서 Frame을 셋팅하는 방법으로 하면 된단다.


- (void)setUILabel:(UILabel *)myLabel withMaxFrame:(CGRect)maxFrame withText:(NSString *)theText usingVerticalAlign:(int)vertAlign 

{

  CGSize stringSize =

  [theText sizeWithFont:myLabel.font constrainedToSize:maxFrame.sizelineBreakMode:myLabel.lineBreakMode];

    

    switch (vertAlign) {

        case 0// vertical align = top

            myLabel.frame = 

              CGRectMake(myLabel.frame.origin.xmyLabel.frame.origin.ymyLabel.frame.size.widthstringSize.height);

            break;

            

        case 1// vertical align = middle

            // don't do anything, lines will be placed in vertical middle by default

            break;

            

        case 2// vertical align = bottom

            myLabel.frame = CGRectMake(myLabel.frame.origin.x

                                       (myLabel.frame.origin.y + myLabel.frame.size.height) - stringSize.height

                                       myLabel.frame.size.width

                                       stringSize.height

                                       );

            break;

    }

    

    myLabel.text = theText;

} 

 

끝.

Posted by 은돌군
2014. 3. 6. 15:53


View에 slide 효과 주는 코드!


    [UIView beginAnimations:nil context:NULL]; //애니메이션 시작

    [UIView setAnimationDuration:0.2]; //슬라이드 동작하는 시간

    [UIView setAnimationDelay:0.2]; //얼마의 시간후 슬라이드 에니메이션이 동작하는지!

    [UIView commitAnimations]; //애니메이션 동작!


Posted by 은돌군