0
나는 떨어 뜨린지도 핀에 최대 3 개의 이미지를 첨부 할 수있는 앱을 개발 중입니다. 현재 UIView에 표시되는 첨부 된 이미지를 볼 수있는 작은 미리보기가 있습니다. 사용자가 미리보기 단추를 누르면 전체 화면 이미지를 볼 수있게하려고합니다. 내가버튼을 한 번 누르면 이미지 전체 화면보기
func image1Click(sender:UIButton)
{
print(sender.tag)
}
func image2Click(sender:UIButton)
{
print(sender.tag)
}
func image3Click(sender:UIButton)
{
print(sender.tag)
}
이 각 미리보기 버튼에 대한 코드가
// Image preview
img1 = UIButton(frame:TCRectMake(x: 18,y:82,width:80,height:110))
img1.backgroundColor = UIColor.clearColor()
img1.contentMode = .ScaleAspectFill
img1.clipsToBounds = true
img1.addTarget(self, action:"selectImage:", forControlEvents: UIControlEvents.TouchUpInside)
popupView.addSubview(img1)
img2 = UIButton(frame:TCRectMake(x: 100.8,y:82,width:80,height:110))
img2.backgroundColor = UIColor.clearColor()
img2.contentMode = .ScaleAspectFill
img2.clipsToBounds = true
img2.addTarget(self, action:"selectImage:", forControlEvents: UIControlEvents.TouchUpInside)
popupView.addSubview(img2)
img3 = UIButton(frame:TCRectMake(x: 183,y:82,width:80,height:110))
img3.backgroundColor = UIColor.clearColor()
img3.contentMode = .ScaleAspectFill
img3.clipsToBounds = true
img3.addTarget(self, action:"selectImage:", forControlEvents: UIControlEvents.TouchUpInside)
popupView.addSubview(img3)
...
// Save image to document
func saveImageIntoDocument(resizeImage:UIImage,saveCompleted:((String)->())? = nil)
{
let documentsUrl = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask).first!
let timeStamp = "\((Int(Timestamp))).png"
let filePath = documentsUrl.relativePath!.stringByAppendingString("/\(timeStamp)")
if saveCompleted != nil
{
saveCompleted!(timeStamp)
}
UIImagePNGRepresentation(fixRotation(resizeImage))!.writeToFile(filePath, atomically: true)
}
는 관련 코드입니다 : 아래 이미지 미리보기 버튼의 예입니다 새로운 무엇보다도 빠져 나면 알려주세요 :) 누군가가 내가 좋아할만한 전체 화면 미리보기를 볼 수 있다면 도움이 될 것입니다!
덕분에, 아무것도 나는이 :(아마 그것은 이미지 인의 ViewController에 가야하나요? – Oscar
어디로 갈 것인가? 뭔가 잘못하고있는 중이 야를 구현할 때 발생하는 것 같다
는. –예 나는 그것을 배치 아직 미리보기를 클릭해도 응답이 없습니다 :(이유를 아십니까? 답장을 보내 주셔서 감사합니다.) – Oscar