Total(379)
-
랜덤값을 중복되지 않게 추출
import UIKit var totalCount = 18 var gemCard = 1 var ranArray = [1,2,3,4,5,6,7,8,9,10,11,12,13] while(totalCount>0) { let randomIndex = Int(arc4random_uniform(UInt32(ranArray.count))) print(ranArray[randomIndex]) ranArray.remove(at: randomIndex) totalCount-=2 }
2017.09.12 -
[AVPlayer] background audio
https://www.youtube.com/watch?v=dqad3XuMwHI 1. 해당 음악 파일을 추가하였을 경우 Build Phases 에 추가가 되었는지 확인해 보자. (ex. sample.mp3) 추가가 안되어있으면 + 버튼으로 추가해 주면 된다. 2. 어플이 종료 되어도 백그라운드에서 돌아갈 수 있게 하려면 아래와 같이 설정 해야 한다. 3. 소스 import UIKit import AVFoundation class ViewController: UIViewController { var audioPlayer = AVAudioPlayer() override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loadi..
2017.09.11 -
ttf, otf 폰트 추가하는 법
https://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/
2017.09.09 -
[Swift] CollectionView Layout 비율 맞추기
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let width = collectionView.frame.width / 4 - 1 return CGSize(width: width, height: width)} func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: I..
2017.09.04 -
UIImageView 를 다른 UIImageView로 동일한 크기로 처리
var TempImageView: UIImageView? = nilvar img: UIImageView? = nil img.image = UIImage(data: "aaaa.png"); if let MainSize = TempImageView?.frame.size { img.frame.size = MainSize TempImageView?.contentMode = UIViewContentMode.scaleAspectFill TempImageView?.clipsToBounds = true TempImageView?.addSubview(img)} 생각나는 대로 작성을 하였기 때문에 작동은 안될 것 같다.다만 위와 비슷하게 작업으로 한다면 처리 될 것이다.
2017.08.21 -
root 패스워드 변경
mysql> select * from user where user = 'root';mysql> update user set password = password('1234') where user = 'root';mysql> flush privileges; 재로그인 하면 변경 된 것을 알 수 있다.flush privileges 를 반드시 해야지 변경된다.
2017.08.21