Unlock second screen Objective c -
i have app lock screen , try multiple screens. don't know unlock second screen. here how unlock second screen :
if([[nsscreen screens] count] > 1){ // draw new window fill screen nsscreen *screen; nsrect screenrect = cgrectmake(0, 0, screen.frame.size.width , screen.frame.size.height); nswindow *secondarymonitorwindow = [[nswindow alloc] initwithcontentrect:screenrect stylemask:nsborderlesswindowmask backing:nsbackingstorebuffered defer:no screen:screen]; [secondarymonitorwindow.contentview exitfullscreenmodewithoptions:nil]; }
i unlock first screen not second, if can me...
if needs fixed following code :
.m
[windowarray insertobject:self.window atindex:0]; //if have many screens nsrect screenrect; nsarray *screenarray = [nsscreen screens]; (nsinteger index = 1; index < [screenarray count]; index++) { nsscreen *screen = [screenarray objectatindex: index]; screenrect = cgrectmake(0, 0, screen.frame.size.width , screen.frame.size.height); nswindow *window = [[nswindow alloc] initwithcontentrect:screenrect stylemask:nsborderlesswindowmask backing:nsbackingstorebuffered defer:no screen:screen]; [window.contentview setwantslayer:yes]; window.contentview.layer.backgroundcolor = [nscolor blackcolor].cgcolor; [window.contentview enterfullscreenmode:[[nsscreen screens] objectatindex:index] withoptions:nil]; [windowarray addobject:window]; }
don't forget add in .h
nsmutablearray *windowarray;
and exitfullscreen :
for(nsinteger index = 1; index < [windowarray count]; index ++){ if([[windowarray objectatindex:index]contentview].infullscreenmode){ [[[windowarray objectatindex:index]contentview] exitfullscreenmodewithoptions:nil]; } }
Comments
Post a Comment