Featured post
objective c - How to make something like iPhone Folders? -
i'm wanting know if there's way can transform view iphone folders. in other words, want view split somewhere in middle , reveal view underneath it. possible?
edit: per suggestion below, could take screenshot of application doing this:
uigraphicsbeginimagecontext(self.view.bounds.size); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *viewimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
not sure this, however.
edit:2 i've figured out how add shadows view, , here's i've achieved (cropped show relevant part):
edit:3
the basic thought take picture of current state , split somewhere. animate both parts setting new frame. don't know how take screenshot programmatically can't provide sample code…
edit: hey hey it's not looking great works ^^
// wouldn't sharp on retina displays, instead use "withoptions" , set scale 0.0 // uigraphicsbeginimagecontext(self.view.bounds.size); uigraphicsbeginimagecontextwithoptions(self.view.bounds.size, no, 0.0); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *f = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); cgrect fstrect = cgrectmake(0, 0, 320, 200); cgrect sndrect = cgrectmake(0, 200, 320, 260); // 0,200,320,280 cgimageref fimageref = cgimagecreatewithimageinrect([f cgimage], fstrect); uiimage *fcroppedimage = [uiimage imagewithcgimage:fimageref]; cgimagerelease(fimageref); cgimageref simageref = cgimagecreatewithimageinrect([f cgimage], sndrect); uiimage *scroppedimage = [uiimage imagewithcgimage:simageref]; cgimagerelease(simageref); uiimageview *first = [[uiimageview alloc]initwithframe:fstrect]; first.image = fcroppedimage; //first.contentmode = uiviewcontentmodetop; uiimageview *second = [[uiimageview alloc]initwithframe:sndrect]; second.image = scroppedimage; //second.contentmode = uiviewcontentmodebottom; uiview *blank = [[uiview alloc]initwithframe:cgrectmake(0, 0, 320, 460)]; blank.backgroundcolor = [uicolor darkgraycolor]; [self.view addsubview:blank]; [self.view addsubview:first]; [self.view addsubview:second]; [uiview animatewithduration:2.0 animations:^{ second.center = cgpointmake(second.center.x, second.center.y+75); }];
you can uncomment 2 .contentmode
lines , quality improve in case subview has offset of 10px or (you can see setting background color both subviews)
//edit 2: ok found bug. had used whole 320x480 screen, had cut off status bar should 320x460 , working great ;)
- Get link
- X
- Other Apps
Comments
Post a Comment