#Users Resources
GET users/me
##Description Get my User object
+ (UIImagePickerController *)tp_getCameraPickeWithParentViewController:(id<UINavigationControllerDelegate, UIImagePickerControllerDelegate, TPOverlayCameraViewDelegate>)parentViewController {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.delegate = parentViewController;
imagePickerController.showsCameraControls = NO;
[UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:10.0 options:UIViewAnimationOptionCurveEaseIn animations:^{
self.view.superview.top -= FilterViewHeight;
} completion:^(BOOL finished) {
self.isShown = YES;
if ([self.delegate respondsToSelector:@selector(filterViewControllerDidShow:)]) {
[self.delegate filterViewControllerDidShow:self];
}
}];
if #available(iOS 8.0, *) { | |
let alertController = UIAlertController(title: "Terms & Conditions", message: kTermsAndConditions, preferredStyle: .Alert) | |
let OKAction = UIAlertAction(title: "OK", style: .Cancel) { (action) in | |
alertController.dismissViewControllerAnimated(true, completion: nil) | |
} | |
alertController.addAction(OKAction) | |
let paragraphStyle = NSMutableParagraphStyle() | |
paragraphStyle.alignment = NSTextAlignment.Left | |
- (void)createPDFfromUIView:(UIView*)aView saveToDocumentsWithFileName:(NSString*)aFilename | |
{ | |
// Creates a mutable data object for updating with binary data, like a byte array | |
NSMutableData *pdfData = [NSMutableData data]; | |
// Points the pdf converter to the mutable data object and to the UIView to be converted | |
UIGraphicsBeginPDFContextToData(pdfData, aView.bounds, nil); | |
UIGraphicsBeginPDFPage(); | |
CGContextRef pdfContext = UIGraphicsGetCurrentContext(); | |
http://stackoverflow.com/questions/18368567/uitableviewcell-with-uitextview-height-in-ios-7 | |
- (void)textViewDidChange:(UITextView *)textView { | |
if ([textView getContentHeight] > 31) { | |
self.noteHeightLayoutConstraint.constant = [textView getContentHeight] + 20; | |
[self.tableView beginUpdates]; | |
[self.tableView endUpdates]; | |
[self scrollToCursorForTextView:textView]; | |
} |
It's worth noting that if you want a currently-focused field to update the keyboard type immediately, there's one extra step: | |
// textField is set to a UIKeyboardType other than UIKeyboardTypeEmailAddress | |
[textField setKeyboardType:UIKeyboardTypeEmailAddress]; | |
[textField reloadInputViews]; |
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { | |
SmoothLineView *smoothLineView = (SmoothLineView *)[self.tableFooterView viewWithTag:SMOOTH_LINE_VIEW_TAG]; | |
CGRect smoothLineViewFrame = [smoothLineView convertRect:self.tableFooterView.bounds toView:self]; | |
CGPoint touchedPoint = [gestureRecognizer locationInView:self]; | |
BOOL result = !CGRectContainsPoint(smoothLineViewFrame, touchedPoint); | |
return result; | |
} |
- (void)sendEmailWithReferral:(Referral *)referral completionBlock:(NetworkCompletionBlock)completion { | |
[[NetworkHelper sharedInstance] updateEmailAuthorizationForRequestHeader]; | |
NSString *appName=[[[NSBundle mainBundle] infoDictionary] objectForKey:(id)kCFBundleNameKey]; | |
NSString *message = [NSString stringWithFormat:@"Hi %@\nI found this interesting. You can join %@ and get discount at http://quickref.io/app/%@?code=%@", referral.name, appName, kGroupID, referral.code]; | |
[[NetworkHelper sharedInstance] POST:@"https://api.mailgun.net/v3/quickref.io/messages" parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData) { | |
[formData appendPartWithFormData:[@"[email protected]" dataUsingEncoding:NSUTF8StringEncoding] name:@"from"]; | |
[formData appendPartWithFormData:[referral.consentEmail dataUsingEncoding:NSUTF8StringEncoding] name:@"to"]; | |
[formData appendPartWithFormData:[message dataUsingEncoding:NSUTF8StringEncoding] name:@"text"]; |