#pragma mark- Device Check=
+ (BOOL) isRetina
{
if([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
return [[UIScreen mainScreen] scale] == 2.0 ? YES : NO;
return NO;
}
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/if_dl.h>
+ (NSString *)getMacAddress {
int mgmtInfoBase[6];
char *msgBuffer = NULL;
size_t length;
unsigned char macAddress[6];
struct if_msghdr *interfaceMsgStruct;
}
For Mac OS-
download sample from
https://developer.apple.com/library/mac/#samplecode/GetPrimaryMACAddress/Introduction/Intro.html
@interface UnderlinedButton : UIButton {
}
+ (UnderlinedButton*) underlinedButton;
@end
@implementation UnderlinedButton
+ (UnderlinedButton*) underlinedButton {
UnderlinedButton* button = [[UnderlinedButton alloc] init];
return button;
}
- (void) drawRect:(CGRect)rect {
CGRect textRect = self.titleLabel.frame;
// need to put the line at top of descenders (negative value)
CGFloat descender = self.titleLabel.font.descender;
CGContextRef contextRef = UIGraphicsGetCurrentContext();
// set to same colour as text
CGContextSetStrokeColorWithColor(contextRef, self.titleLabel.textColor.CGColor);
CGContextMoveToPoint(contextRef, textRect.origin.x, textRect.origin.y + textRect.size.height + descender);
CGContextAddLineToPoint(contextRef, textRect.origin.x + textRect.size.width, textRect.origin.y + textRect.size.height + descender);
CGContextClosePath(contextRef);
CGContextDrawPath(contextRef, kCGPathStroke);
}
@end