//Detect if this is an iPad if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ //this is iPad }
read more
//Detect if this is an iPad if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ //this is iPad }
read more
#import "NSDataAdditions.h"
@implementation Cryptography
const size_t BUFFER_SIZE = 240;
const size_t CIPHER_BUFFER_SIZE = 1024;
const uint32_t PADDING = kSecPaddingPKCS1;
- (NSString*) test1
{
uint8_t *plainBuffer;
uint8_t *decryptedBuffer;
const char inputString[] = "some data";
int len = strlen(inputString);
plainBuffer = (uint8_t *)calloc(len, sizeof(uint8_t));
strncpy( (char *)plainBuffer, inputString, len);
NSString * path = [[NSBundle mainBundle] pathForResource:@"test1" ofType ...
read more- (void) Send :(NSString*) tarXML
{
recordResults = FALSE;
NSString *soapMessage = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
"<soap:Body>\n"
"<TestDecrypt xmlns=\"http ...
read more
//Method writes a string to a text file
-(void) writeToTextFile{
//get the documents directory:
NSArray *paths = NSSearchPathForDirectoriesInDomains
(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
//make a file name to write the data to using the documents directory:
NSString *fileName = [NSString stringWithFormat:@"%@/textfile.txt",
documentsDirectory];
//create content - four lines of ...
read more///////////////////BUTON
//-- button.h file
@interface MyButton : NSObject {
id receiver;
SEL selector;
}
//-- button.m file
-(void)addTarget:(id)target action:(SEL)action{
receiver = target;
selector = action;
}
-(void)touch{
if (receiver) {
[receiver performSelector:selector];
}
}
//////////////////RECEIVER
//-- receiver.m file
...
MyButton *mybutton = [[MyButton alloc] init];
[mybutton addTarget:self action:@selector(actionMethod)];
...
-(void)actionMethod{
//some ...
read more//Add icnon files to projects
//Add following to info.plist
<key>CFBundleIconFiles</key>
<array>
<string>Icon.png</string>
<string>iconiPad.png</string>
</array>
read moreUIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" message:@"Alert" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; alert.transform = CGAffineTransformTranslate( alert.transform, 0.0, 100.0 ); [alert show]; [alert release];
read more
[self.navigationItem setHidesBackButton:YES];
#import "NSDataAdditions.h"
-(NSString *)getStringFromImage:(UIImage *)image{
if(image){
NSData *dataObj = UIImagePNGRepresentation(image);
return [dataObj base64Encoding];
} else {
return @"";
}
NSData *dataObj = [NSData dataWithBase64EncodedString:beforeStringImage];
UIImage *beforeImage = [UIImage imageWithData:dataObj];
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
cameraButton.enabled = NO;
} else {
cameraButton.enabled = YES;
}
read more