ios - How to create if-else loop near #import sttatement to check the Device Type (iPad/iPhone) -


i using pkrevealcontroller create splitview in app. in pkrevealcontroller.m file giving value how screen reveal using code

#define default_left_view_width_range nsmakerange(273, 310) 

this iphone want make loop select size. if device ipad large else small how can because outside of @interface pkrevealcontroller

i have check code on google , find this

#if defined(__iphone_6_0) || defined(__mac_10_8) #define af_cast_to_block id #else #define af_cast_to_block __bridge void * 

so can create selecting device?

you can use code achive change value according need

in pkrevealcontroller.m

#define default_left_view_width_range_ipad nsmakerange(700, 700)  #define default_left_view_width_range_iphone nsmakerange(273, 310)  #define default_right_view_width_range_ipad default_left_view_width_range_ipad #define default_right_view_width_range_iphone default_left_view_width_range_iphone 

and in iterface find out setup method replace method

pragma mark - setup

- (void)setup {     self.state = pkrevealcontrollerfocusesfrontviewcontroller;     if ([[uidevice currentdevice] userinterfaceidiom] ==uiuserinterfaceidiomphone)     {         //device iphone         self.leftviewwidthrange = default_left_view_width_range_iphone;         self.rightviewwidthrange = default_right_view_width_range_iphone;     }     else     {         //device ipad         self.leftviewwidthrange = default_left_view_width_range_ipad;         self.rightviewwidthrange = default_right_view_width_range_ipad;     }       self.view.autoresizingmask = (uiviewautoresizingflexibleheight | uiviewautoresizingflexiblewidth); } 

than should work..:)


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -