#define IS_RETINA ([[UIScreen mainScreen] respondsToSelector:@selector(displayLinkWithTarget:selector:)] && ([UIScreen mainScreen].scale == 2.0))
if(IS_RETINA)
{
// Retina display
} else {
// non-Retina display
}
Showing posts with label screen. Show all posts
Showing posts with label screen. Show all posts
Full Screen Dialog
final Dialog instructionDialog = new Dialog(getParent(), android.R.style.Theme);
instructionDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
instructionDialog.setContentView(getLayoutInflater().inflate(R.layout.dialog_instruction
, null));
instructionDialog.getWindow().setLayout(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
Button btn = (Button) instructionDialog.findViewById(R.id.btn_instruction);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
instructionDialog.dismiss();
}
});
instructionDialog.show();
Make a UIImage from a MKMapView or Other View
The improved function for retina display:
- (UIImage*) renderToImage
{
if(UIGraphicsBeginImageContextWithOptions != NULL)
{
UIGraphicsBeginImageContextWithOptions(mapView.frame.size, NO, 0.0);
} else {
UIGraphicsBeginImageContext(mapView.frame.size);
}
[mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
Subscribe to:
Posts (Atom)