Search Results

Search found 15682 results on 628 pages for 'iphone privateapi'.

Page 171/628 | < Previous Page | 167 168 169 170 171 172 173 174 175 176 177 178  | Next Page >

  • iPhone hitTest broken after rotation

    - by Adam
    Hi all, I have a UIView that contains a number of CALayer subclasses. I am using the following code to detect which layer a touch event corresponds to: - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint touchPoint = [touch locationInView:self]; NSLog(@"%@,%@",NSStringFromCGPoint(point),[self.layer hitTest:point].name); } This works fine until the device is rotated. When the device is rotated all current layers are removed from the superlayer, and new CALayers are created to fit the new orientation. The new layers are correctly inserted and viewable in the correct orientation. After the rotation the hitTest method consistently returns nil when clearly clicking on the newly created layers and registers for locations of layers which are incorrect. The coordinates of the hit test are correct, but no layers are found. Am I missing a function call or something after handling the rotation? Cheers, Adam

    Read the article

  • iPhone: Override UIButton buttonWithType to return subclass

    - by Amagrammer
    I want to be able to create a UIButton with an oversized responsive area. I know that one way to do that is to override the hitTest method in a subclass, but how do I instantiate my custom button object in the first place? [OversizedButton buttonWithType: UIButtonTypeDetailDisclosure]; doesn't work out of the box because buttonWithType returns a UIButton, not an OversizedButton. So it seems like I need to override the buttonWithType method as well. Does anyone know how to do this? @implementation OversizedButton + (id)buttonWithType:(UIButtonType)buttonType { // Construct and return an OversizedButton rather than a UIButton // Needs to handle special types such as UIButtonTypeDetailDisclosure // I NEED TO KNOW HOW TO DO THIS PART } - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { // Return results if touch event was in oversized region // I ALREADY KNOW HOW TO DO THIS PART } @end Alternatively, maybe I could create the button using alloc/initWithFrame. But the buttonType property is readonly, so how do you create the custom button types? Note: I know there are other ways to do this, such as having an invisible button behind the visible one. I don't care for that approach and would prefer to avoid it. Any help on the approach described above would be very helpful. Thanks

    Read the article

  • UIImage cropping on user selected rectangle in iphone?

    - by Rajendra Bhole
    Hi, I developing an small application in which i want to crop the UIImage captured by imagePickerControllerSourceTypeOfCamera. The UIImage should crop by user selected crop area or cropped rectangle. That means first user capture the image from the camera.Then on captured image the user selected an rectangle having color gray.That image(image data) should crop from that gray colored rectangle. My under develop code is as follows. -(IBAction) getPhoto:(id)sender { UIImagePickerController* imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.delegate = self; if((UIButton *) sender == btnphotoAlbum) { imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; } else { imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; } imagePickerController.allowsImageEditing = YES; //imagePickerController.toolbar.barStyle =UIBarStyleBlackOpaque; //UIToolbar *toolBar=[[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 20, 320)]; //imagePickerController. [self presentModalViewController:imagePickerController animated:YES]; } (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo { UIImage *selectedImage = image; UIImage *originalImage = [editingInfo objectForKey:@"UIImagePickerControllerOriginalImage"]; NSValue *cropRect = [editingInfo objectForKey:UIImagePickerControllerCropRect]; CGRect theRect = [cropRect CGRectValue]; //captureImage.image =[info objectForKey:@"UIImagePickerControllerOriginalImage"]; [picker dismissModalViewControllerAnimated:YES]; } How i crop the image?

    Read the article

  • Key Coder/Observer example for Iphone

    - by ReduxDJ
    I'm trying to implement KVO into an application, yet, I've followed the documentation provided by Apple, however I can't get it to work. I'm hoping to see a bare minimal example of how to use this with my NSObjects. My use case, is I want one item in a table-cell to update without loading the entire data in a tableView because I am loading images from URLs and I don't want to reload all of the image, while I am polling a server. Thanks,

    Read the article

  • iphone UITextField remembering user's previous input???

    - by Rob
    Is there a way to remember what the user put into a UITextField and have it displayed the next time they come to that UITextField? i.e. - have them input their name the first time they come to the "Name" UITextField but have that name already displayed in that field the next time they come across that UITextField? I want the name to still be editable if they come back to the UITextField, but inputted nonetheless in case they don't need to change it the second time around.

    Read the article

  • iphone Dev - activity indicator with NSThread not working on Nav controller table view

    - by Frames84
    I really can't get this to work, basically when my JSON feeds loads I want the indicator to show, then hide when it's stopped. It loads top level menu items 1st "Publishing, Broadcasting, Marketing Services", then when Broadcasting is selected it loads a feed using the JSON framework hosted on Google. Round this load I call startIndicator and stopIndicator using the NSThread. Have I missed something? @implementation GeneralNewsTableViewController @synthesize dataList; @synthesize generalNewsDetailViewController; @synthesize atLevel; -(void) startIndicator { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc ] init ]; [(UIActivityIndicatorView *)[self navigationItem].rightBarButtonItem.customView startAnimating]; [pool release]; } -(void) stopIndicator { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc ] init ]; [(UIActivityIndicatorView *)[self navigationItem].rightBarButtonItem.customView stopAnimating]; [pool release]; } - (void)viewDidLoad { NSMutableArray *checker = self.dataList; if(checker == nil) { self.title = NSLocalizedString(@"General1",@"General News"); NSMutableArray *array = [[NSArray alloc] initWithObjects:@"Publishing", @"Broadcasting",@"Marketing Services",nil]; self.dataList = [array retain]; self.atLevel = @"level1"; [array release]; } UIActivityIndicatorView * activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)]; //set the initial property [activityIndicator stopAnimating]; [activityIndicator hidesWhenStopped]; //Create an instance of Bar button item with custome view which is of activity indicator UIBarButtonItem * barButton = [[UIBarButtonItem alloc] initWithCustomView:activityIndicator]; //Set the bar button the navigation bar [self navigationItem].rightBarButtonItem = barButton; //Memory clean up [activityIndicator release]; [barButton release]; [super viewDidLoad]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *level = self.atLevel; if([level isEqualToString:@"level2"]) { return 70.0f; } else { return 40.0f; } } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *FirstLevelCell = @"FirstLevelCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:FirstLevelCell]; if(cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:FirstLevelCell] autorelease]; } NSInteger row = [indexPath row]; NSString *level = self.atLevel; if([level isEqualToString:@"level2"]) { NSMutableArray *stream = [self.dataList objectAtIndex:row]; NSString *newsTitle = [stream valueForKey:@"title"]; if( ![newsTitle isKindOfClass:[NSString class]] ) { cell.textLabel.text = @""; } else { cell.textLabel.text = [stream valueForKey:@"title"]; } cell.textLabel.numberOfLines = 2; cell.textLabel.font =[UIFont systemFontOfSize:10]; cell.detailTextLabel.numberOfLines = 1; cell.detailTextLabel.font= [UIFont systemFontOfSize:8]; cell.detailTextLabel.text = [stream valueForKey:@"created"]; NSData *imageURL = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.how-do.co.uk/images/stories/Cimex.jpg"]]; UIImage *newsImage = [[UIImage alloc] initWithData:imageURL]; cell.imageView.image = newsImage; [imageURL release]; [newsImage release]; } else { cell.textLabel.text = [dataList objectAtIndex:row]; } return cell; } - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; NSMutableString *levelType = (NSMutableString *) [dataList objectAtIndex:row]; if(![levelType isKindOfClass:[NSString class]]) { if(self.generalNewsDetailViewController == nil) { GeneralNewsDetailViewController *generalDetail = [[GeneralNewsDetailViewController alloc] initWithNibName:@"GeneralNewsDetailView" bundle:nil]; self.generalNewsDetailViewController = generalDetail; [generalDetail release]; } NSDictionary *stream = [self.dataList objectAtIndex:row]; NSString *newsTitle = [stream valueForKey:@"title"]; if( ![newsTitle isKindOfClass:[NSString class]] ) { generalNewsDetailViewController.newsTitle = @""; } else { generalNewsDetailViewController.newsTitle =[stream valueForKey:@"title"]; } generalNewsDetailViewController.newsId = [stream valueForKey:@"id"]; generalNewsDetailViewController.fullText = [stream valueForKey:@"fulltext"]; generalNewsDetailViewController.newsImage = [stream valueForKey:@"images"]; generalNewsDetailViewController.created = [stream valueForKey:@"created"]; HowDo_v1AppDelegate *delegate = [[UIApplication sharedApplication] delegate]; [delegate.generalNewsNavController pushViewController:self.generalNewsDetailViewController animated:YES]; } else { GeneralNewsTableViewController *generalSubDetail = [[GeneralNewsTableViewController alloc] initWithNibName:@"GeneralNewsTableView" bundle:nil]; NSMutableArray *array; NSString *titleSelected = (NSString *) [dataList objectAtIndex:row]; if([titleSelected isEqualToString:@"Publishing"]) { generalSubDetail.title = @"Publishing news detail"; array = [[NSArray alloc] initWithObjects:@"pub News1", @"pub News2",@"pub News3",nil]; generalSubDetail.atLevel = @"level1"; } else if ([titleSelected isEqualToString:@"Broadcasting"]) { generalSubDetail.title = @"Broadcasting news detail"; /// START [self performSelectorOnMainThread:@selector(startIndicator) withObject:nil waitUntilDone:YES]; if(jSONDataAccessWrapper == nil) { jSONDataAccessWrapper = [JSON_DataAccess_Wrapper alloc]; } array = [jSONDataAccessWrapper downloadJSONFeed]; [self performSelectorOnMainThread:@selector(stopIndicator) withObject:nil waitUntilDone:YES]; generalSubDetail.atLevel = @"level2"; } else if ([titleSelected isEqualToString:@"Marketing Services"]) { generalSubDetail.title = @"Marketing Services news detail"; array = [[NSArray alloc] initWithObjects:@"Marketing News1", @"Marketing News2",@"Marketing News3",nil]; generalSubDetail.atLevel = @"level1"; } generalSubDetail.dataList = array; [self.navigationController pushViewController:generalSubDetail animated:YES]; [titleSelected release]; } } - (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section //- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSIndexPath *) section { return [self.dataList count]; } Cheers for any feedback Frames

    Read the article

  • Best FTP Objective-C wrapper for iPhone

    - by jamone
    I know you use the C based networking API to do FTP communication but I'd prefer to use something a little higher level. I've seen a few Objective-C based wrappers but I'm not sure what to use. I don't need that complex of FTP interaction. Its just the typical create/delete dirs, upload/download files... What do you recommend?

    Read the article

  • iPhone SDK: Transparent tableviewcell isn't transparent?

    - by Harkonian
    I have a UITableViewController that has a background image. I am setting the image for the tableview like this: [self.view setBackgroundColor: [UIColor colorWithPatternImage: [UIImage imageWithContentsOfFile: [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: @"background1.jpg"]]]]; The problem is, each of my custom tableview cells get the same background image--it's repeated in each cell. As a test, I tried making everything in my cell transparent with an alpha of 0.0, but even then although I can't see any of the labels in each cell, I still see the background image repeated in each cell: cell.backgroundColor = [UIColor clearColor]; cell.contentView.backgroundColor = [UIColor clearColor]; cell.contentView.alpha = 0.0; cell.alpha = 0.0; Any suggestions on how to get my table's background image to stop repeating in each cell would be appreciated!

    Read the article

  • iPhone: convert string using HMAC-SHA1

    - by Rupesh
    hi all, i want to generate HMAC-SHA1 of NSString type variable. I see the post but this method give me error in CCHmac(kCCHmacAlgSHA256, cKey, strlen(cKey), cData, strlen(cData), cHMAC); and NSString *hash = [HMAC base64Encoding]; line. Please suggest how can I generate the HMAC-SHA1 of any string.

    Read the article

  • How to handle correctly HTTP Digest Authentication on iPhone

    - by Fabiano Francesconi
    Hello guys. I'm trying to upload a file onto my personal server. I've written a small php page that works flawlessy so far. The little weird thing is the fact that I generate all the body of the HTTP message I'm going to send (let's say that amounts to ~4 mb) and then I send the request to my server. The server, then, asks for an HTTP challenge and my delegate connection:didReceiveAuthenticationChallenge:challenge replies to the server with the proper credentials and the data. But, what's happened? The data has been sent twice! In fact I've noticed that when I added the progressbar.. the apps sends the data (4mb), the server asks for authentication, the apps re-sends the data with the authentication (another 4mb). So, at the end, I've sent 8mb. That's wrong. I started googling and searching for a solution but I can't figure out how to fix this. The case scenarios are two (my guess): Share the realm for the whole session (a minimal HTTP request, then challenge, then data) Use the synchronized way to perform an HTTP connection (things that I do not want to do since it seems an ugly way to handle this kind of stuff to me) Thank you

    Read the article

  • iPhone development: pointer being freed was not allocated

    - by w4nderlust
    Hello, i got this message from the debugger: Pixture(1257,0xa0610500) malloc: *** error for object 0x21a8000: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug so i did a bit of tracing and got: (gdb) shell malloc_history 1257 0x21a8000 ALLOC 0x2196a00-0x21a89ff [size=73728]: thread_a0610500 |start | main | UIApplicationMain | GSEventRun | GSEventRunModal | CFRunLoopRunInMode | CFRunLoopRunSpecific | __CFRunLoopDoObservers | CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) | CA::Transaction::commit() | CA::Context::commit_transaction(CA::Transaction*) | CALayerDisplayIfNeeded | -[CALayer _display] | CABackingStoreUpdate | backing_callback(CGContext*, void*) | -[CALayer drawInContext:] | -[UIView(CALayerDelegate) drawLayer:inContext:] | -[AvatarView drawRect:] | -[AvatarView overlayPNG:] | +[UIImageUtility createMaskOf:] | UIGraphicsGetImageFromCurrentImageContext | CGBitmapContextCreateImage | create_bitmap_data_provider | malloc | malloc_zone_malloc and i really can't understand what i am doing wrong. here's the code of the [UIImageUtility createMaskOf:] function: + (UIImage *)createMaskOf:(UIImage *)source { CGRect rect = CGRectMake(0, 0, source.size.width, source.size.height); UIGraphicsBeginImageContext(CGSizeMake(source.size.width, source.size.height)); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, 0, source.size.height); CGContextScaleCTM(context, 1.0, -1.0); UIImage *original = [self createGrayCopy:source]; CGContextRef context2 = CGBitmapContextCreate(NULL, source.size.width, source.size.height, 8, 4 * source.size.width, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipLast); CGContextDrawImage(context2, CGRectMake(0, 0, source.size.width, source.size.height), original.CGImage); CGImageRef unmasked = CGBitmapContextCreateImage(context2); const float myMaskingColorsFrameColor[6] = { 1,256,1,256,1,256 }; CGImageRef mask = CGImageCreateWithMaskingColors(unmasked, myMaskingColorsFrameColor); CGContextSetRGBFillColor (context, 256,256,256, 1); CGContextFillRect(context, rect); CGContextDrawImage(context, rect, mask); UIImage *whiteMasked = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return whiteMasked; } the other custom function called before that is the following: - (UIImage *)overlayPNG:(SinglePart *)sp { NSLog([sp description]); // Rect and context setup CGRect rect = CGRectMake(0, 0, sp.image.size.width, sp.image.size.height); NSLog(@"%f x %f", sp.image.size.width, sp.image.size.height); // Create an image of a color filled rectangle UIImage *baseColor = nil; if (sp.hasOwnColor) { baseColor = [UIImageUtility imageWithRect:rect ofColor:sp.color]; } else { SinglePart *facePart = [editingAvatar.face.partList objectAtIndex:0]; baseColor = [UIImageUtility imageWithRect:rect ofColor:facePart.color]; } // Crete the mask of the layer UIImage *mask = [UIImageUtility createMaskOf:sp.image]; mask = [UIImageUtility createGrayCopy:mask]; // Create a new context for merging the overlay and a mask of the layer UIGraphicsBeginImageContext(CGSizeMake(sp.image.size.width, sp.image.size.height)); CGContextRef context2 = UIGraphicsGetCurrentContext(); // Adjust the coordinate system so that the origin // is in the lower left corner of the view and the // y axis points up CGContextTranslateCTM(context2, 0, sp.image.size.height); CGContextScaleCTM(context2, 1.0, -1.0); // Create masked overlay color layer CGImageRef MaskedImage = CGImageCreateWithMask (baseColor.CGImage, mask.CGImage); // Draw the base color layer CGContextDrawImage(context2, rect, MaskedImage); // Get the result of the masking UIImage* overlayMasked = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIGraphicsBeginImageContext(CGSizeMake(sp.image.size.width, sp.image.size.height)); CGContextRef context = UIGraphicsGetCurrentContext(); // Adjust the coordinate system so that the origin // is in the lower left corner of the view and the // y axis points up CGContextTranslateCTM(context, 0, sp.image.size.height); CGContextScaleCTM(context, 1.0, -1.0); // Get the result of the blending of the masked overlay and the base image CGContextDrawImage(context, rect, overlayMasked.CGImage); // Set the blend mode for the next drawn image CGContextSetBlendMode(context, kCGBlendModeOverlay); // Component image drawn CGContextDrawImage(context, rect, sp.image.CGImage); UIImage* blendedImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); CGImageRelease(MaskedImage); return blendedImage; }

    Read the article

  • iPhone:Tabbar item actions are not happening

    - by user187532
    Hello all, I created a window application, which has a tabbar controller with four tabbar items. Each tabbar items are linked with a tableview. I have also set Navigation bar for each tabbar items. I have appdelegate file, which calls the first tableview controller of which is set for first tabbar item. I am trying to retrieve and do an action whenever a tabbar item is clicked. For that, i tried to add "- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item" and "- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UITableViewController *)viewController" in my first tableview controller, but it is not at all responding whenever i click any tabbar items. My question is, if i create a window based application and added tabbar controller, tableview and navigation bar in .XIB file, is it not possible to access and do an action programatically whenever a tabbar item is clicked? (or) Am i doing anything wrong? Please help me to resolve this and share your ideas. Thanks.

    Read the article

  • iPhone: Memory leak when using NSOperationQueue...

    - by MacTouch
    Hi, I'm sitting here for at least half an hour to find a memory leak in my code. I just replaced an synchronous call to a (touch) method with an asynchronous one using NSOperationQueue. The Leak Inspector reports a memory leak after I did the change to the code. What's wrong with the version using NSOperationQueue? Version without a MemoryLeak -(NSData *)dataForKey:(NSString*)ressourceId_ { NSString *path = [self cachePathForKey:ressourceId_]; // returns an autoreleased NSString* NSString *cacheKey = [self cacheKeyForRessource:ressourceId_]; // returns an autoreleased NSString* NSData *data = [[self memoryCache] valueForKey:cacheKey]; if (!data) { data = [self loadData:path]; // returns an autoreleased NSData* if (data) { [[self memoryCache] setObject:data forKey:cacheKey]; } } [[self touch:path]; return data; } Version with a MemoryLeak (I do not see any) -(NSData *)dataForKey:(NSString*)ressourceId_ { NSString *path = [self cachePathForKey:ressourceId_]; // returns an autoreleased NSString* NSString *cacheKey = [self cacheKeyForRessource:ressourceId_]; // returns an autoreleased NSString* NSData *data = [[self memoryCache] valueForKey:cacheKey]; if (!data) { data = [self loadData:path]; // returns an autoreleased NSData* if (data) { [[self memoryCache] setObject:data forKey:cacheKey]; } } NSInvocationOperation *touchOp = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(touch:) object:path]; [[self operationQueue] addOperation:touchOp]; [touchOp release]; return data; } And of course, the touch method does nothing special too. Just change the date of the file. -(void)touch:(id)path_ { NSString *path = (NSString *)path_ NSFileManager *fm = [NSFileManager defaultManager]; if ([fm fileExistsAtPath:path]) { NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSDate date], NSFileModificationDate, nil]; [fm setAttributes: attributes ofItemAtPath:path error:nil]; } }

    Read the article

  • iPhone: In landscape-only, after first addSubview, UITableViewController doesn't rotate properly

    - by Clay Bridges
    A minimal illustrative Xcode project for this is available on github. On my UIWindow, when I add second (and subsequent) UITableView's as subviews, they do not rotate properly, and thus appear sideways. This is only tested in the Simulator. Here's a little code for you: - (void)applicationDidFinishLaunching:(UIApplication *)application { ShellTVC* viewA = [[ShellTVC alloc] initWithTitle:@"View A"]; ShellTVC* viewB = [[ShellTVC alloc] initWithTitle:@"View B"]; // The first subview added will rotate to landscape correctly. // Any subsequent subview added will not. // You may try this by various commentings and rearranging of these two statements. [window addSubview:[viewA tableView]]; [window addSubview:[viewB tableView]]; [window makeKeyAndVisible]; } viewB appears sideways. Comment out the addSubview for viewB, and viewA appears correctly. Do that for viewA only, and viewB appears correctly. I am not creating these UITableViewControllers via NIBs, though the UIWindow is. In case you are wondering, ShellTVC is-a UITableViewController, and implements this method: - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft); } Also, I have set the UIInterfaceOrientation in the plist file to UIInterfaceOrientationLandscapeLeft. Probably related -- and unanswered -- SO questions here and here.

    Read the article

  • UITabBarController rotation problem with popViewControllerAnimated and selectedIndex (iPhone SDK)

    - by rjobidon
    Hi! This is a very important auto rotate issue and easy to reproduce. My application has a UITabBarController. Each tab is a UINavigationController. Auto rotation is handled with normal calls to shouldAutorotateToInterfaceOrientation and didRotateFromInterfaceOrientation. The interface rotates normally until I call UIViewController.popViewControllerAnimated and change UITabBarController.selectedIndex. Steps to reproduce: Create a demo Tab Bar Application. Add the following code to the App Delegate .h file: #import <UIKit/UIKit.h> @interface TestRotationAppDelegate : NSObject { UIWindow *window; UITabBarController *tabBarController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController; -(void)doAction; @end // Redefine the interface to cach rotation messages @interface UITabBarController (TestRotation1AppDelegate) @end Add the following code to the App Delegate .m file: #import "TestRotationAppDelegate.h" @implementation TestRotationAppDelegate @synthesize window; @synthesize tabBarController; -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [window addSubview:tabBarController.view]; [window makeKeyAndVisible]; return YES; } -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } -(void)dealloc { [tabBarController release]; [window release]; [super dealloc]; } @end @implementation UITabBarController (TestRotation1AppDelegate) -(void)viewDidLoad { [super viewDidLoad]; // Add a third tab and push a view UIViewController *view1 = [[UIViewController alloc] init]; view1.title = @"Third"; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:view1]; NSMutableArray *array = [[NSMutableArray alloc] init]; [array addObjectsFromArray:self.viewControllers]; [array addObject:nav]; self.viewControllers = array; // Push view2 inside the third tab UIViewController *view2 = [[UIViewController alloc] init]; [nav pushViewController:view2 animated:YES]; // Create a button to pop view2 UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(50, 50, 220, 38); [button setTitle:@"Pop this view" forState:UIControlStateNormal]; [button addTarget:self action:@selector(doAction) forControlEvents:UIControlEventTouchUpInside]; [view2.view addSubview:button]; } -(void) doAction { // ROTATION PROBLEM BEGINS HERE // Remove one line of code and the problem doesn't occur. [self.selectedViewController popViewControllerAnimated:YES]; self.selectedIndex = 0; } -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } @end The interface auto rotates normally until you tap the button on tab #3. Your help will be geatly appreciated!

    Read the article

  • iphone: UIwebview curl effect

    - by eshalev
    Hello, I would like to make a standard view container which will give me the curl animation effect on multiple views. Something like uiscrollview and paging, only with a different animation(curl). I will be using UIwebviews as my separate pages. The problem: I do not know how to trap swipes in UIwebviews, But I see that UIscrollview implments this (swiping a uiwebview in a uiscrollview will bring me to the next view). I am therefore assuming that the implmentation of UIscrollview is trapping UIwebview swipes. How can i achieve the same functionality? I also need the UIWebview to keep functioning (as when embedding it in a uiscrollview)

    Read the article

  • iPhone SDK can't get UIScrollView to work with a UIWebView

    - by Maxwell Segal
    I am building an app that in part of it has two views - one portrait and one landscape. And I want to offer scrolling and pinch & zooming on the landscape orientation. I've built the two views and the simple UIImages in the landscape view all work OK but it does not seem to insert my UIWebView into the UIScrollView. I've done this before with UIImage and all was OK but I must be missing something here - can anybody help with some advice. I'm sure it's something very simple - perhaps to do with the adding of the subview??. Thanks in advance of your help. I've shown the relevant parts of my code below: @interface MonthViewController : UIViewController <UIScrollViewDelegate> { MonthViewController *monthController; IBOutlet UIView *portraitView; IBOutlet UIView *landscapeView; IBOutlet UIWebView *monthKWHChartPortrait; UIWebView *monthKWHChartLandscape; IBOutlet UIScrollView *scrollChartLandscape; IBOutlet UIImageView *eLogoPortrait; IBOutlet UIImageView *eLogoLandscape; IBOutlet UIImageView *clientLogoPortrait; IBOutlet UIImageView *clientLogoLandscape; IBOutlet UIActivityIndicatorView *loadIndicatorPortrait; IBOutlet UIActivityIndicatorView *loadIndicatorLandscape; NSTimer *timer; IBOutlet UILabel *test; } -(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollChartLandscape { return monthKWHChartLandscape; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight); } -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [super willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:duration]; if (toInterfaceOrientation ==UIInterfaceOrientationLandscapeRight) { NSLog(@"right"); test.text=@"right"; NSString *urlAddressLandscape = @"http://PRIVATEURLHERE.aspx?WIDTH=440"; NSURL *urlLandscape = [NSURL URLWithString:urlAddressLandscape]; NSURLRequest *requestObjLandscape = [NSURLRequest requestWithURL:urlLandscape]; [self.monthKWHChartLandscape loadRequest:requestObjLandscape]; scrollChartLandscape.contentSize = CGSizeMake(monthKWHChartLandscape.frame.size.width, monthKWHChartLandscape.frame.size.height); scrollChartLandscape.maximumZoomScale = 2.5; scrollChartLandscape.minimumZoomScale = 0.6; scrollChartLandscape.showsHorizontalScrollIndicator = YES; scrollChartLandscape.showsVerticalScrollIndicator = YES; scrollChartLandscape.clipsToBounds = YES; scrollChartLandscape.delegate = self; [self.scrollChartLandscape addSubview:monthKWHChartLandscape]; self.view=landscapeView; //self.view.transform=CGAffineTransformMakeRotation(deg2rad*(90)); //self.view.bounds=CGRectMake(0.0, 0.0, 480.0, 320.0); } else

    Read the article

  • Replacing image in sprite - cocos2d game development of iphone

    - by sagar
    I want to change the sprite image. Say for example. mainSprite=[Sprite spriteWithFile:@"redFile.png"]; [self addChild:mainSprite]; Here, Sprite is already added to a layer. I have mainSprite (pointer) which can access it. If I change [mainSprite setOpacity:150]; it works perfectly. But Here I want to change the sprite image instead of opacity. But Don't know how? Thanks in advance for helping me. Sagar

    Read the article

  • iPhone SDK: How to add an image to a UIBarButton?

    - by iPhone Developer
    I have used the code below to create a button on the nav bar with an image. I can see the image but I can also see the border of the button around it. My question is, how can I get rid of the button border. All I want to see is the image on the nav bar, no border. UIBarButtonItem *settingsBtn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_prefs.png"] style:UIBarButtonItemStylePlain target:self action:@selector(openSettings:)]; [[self navigationItem] setLeftBarButtonItem:settingsBtn]; [settingsBtn release]; Thanks in advance. Any pointers, links to read further or examples appreciated.

    Read the article

  • problem FFmpeg avcodec_register_all iphone

    - by samantha
    Hi, I need to use ffmpeg for encodig. I have all *.a. My problem is tha when I use avcodec_register_all() xcode give me this error: "_deflate", referenced from: _encode_frame in libavcodec.a(pngenc.o) _encode_frame in libavcodec.a(pngenc.o) _encode_frame in libavcodec.a(pngenc.o) _encode_frame in libavcodec.a(lclenc.o) _encode_frame in libavcodec.a(lclenc.o) _encode_frame in libavcodec.a(zmbvenc.o) "_deflateEnd", referenced from: _flashsv_encode_end in libavcodec.a(flashsvenc.o) _encode_frame in libavcodec.a(pngenc.o) _encode_end in libavcodec.a(lclenc.o) _encode_end in libavcodec.a(zmbvenc.o) "_compress", referenced from: _encode_strip in libavcodec.a(tiffenc.o) (maybe you meant: _mp3_header_compress_bsf$non_lazy_ptr, _mp3_header_compress_bsf ) "_vorbis_analysis_init", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_lame_set_bWriteVbrTag", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_lame_set_VBR", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_crc32", referenced from: _png_write_chunk in libavcodec.a(pngenc.o) _png_write_chunk in libavcodec.a(pngenc.o) _png_write_chunk in libavcodec.a(pngenc.o) "_x264_encoder_headers", referenced from: _X264_init in libavcodec.a(libx264.o) "_lame_encode_buffer", referenced from: _MP3lame_encode_frame in libavcodec.a(libmp3lame.o) "_x264_encoder_encode", referenced from: _X264_frame in libavcodec.a(libx264.o) "_vorbis_comment_add_tag", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_theora_encode_tables", referenced from: _encode_init in libavcodec.a(libtheoraenc.o) "_vorbis_block_init", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_x264_nal_encode", referenced from: _X264_frame in libavcodec.a(libx264.o) _X264_init in libavcodec.a(libx264.o) "_uncompress", referenced from: _decode_frame in libavcodec.a(cscd.o) _decode_frame in libavcodec.a(dxa.o) _svq3_decode_init in libavcodec.a(h264.o) _decode_frame in libavcodec.a(tiff.o) "_xvid_plugin_2pass2", referenced from: _ff_xvid_rate_control_init in libavcodec.a(libxvid_rc.o) _ff_xvid_rate_estimate_qscale in libavcodec.a(libxvid_rc.o) _ff_xvid_rate_estimate_qscale in libavcodec.a(libxvid_rc.o) _ff_xvid_rate_control_uninit in libavcodec.a(libxvid_rc.o) _xvid_plugin_2pass2$non_lazy_ptr in libavcodec.a(libxvidff.o) (maybe you meant: _xvid_plugin_2pass2$non_lazy_ptr) "_lame_set_num_channels", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_lame_set_VBR_q", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_vorbis_analysis_buffer", referenced from: _oggvorbis_encode_frame in libavcodec.a(libvorbis.o) "_compress2", referenced from: _flashsv_encode_frame in libavcodec.a(flashsvenc.o) "_inflateEnd", referenced from: _decode_frame in libavcodec.a(pngdec.o) _flashsv_decode_end in libavcodec.a(flashsv.o) _decode_end in libavcodec.a(lcldec.o) _decode_end in libavcodec.a(tscc.o) _decode_end in libavcodec.a(zmbv.o) "_lame_encode_buffer_interleaved", referenced from: _MP3lame_encode_frame in libavcodec.a(libmp3lame.o) "_theora_comment_clear", referenced from: _encode_init in libavcodec.a(libtheoraenc.o) "_x264_encoder_close", referenced from: _X264_close in libavcodec.a(libx264.o) "_inflate", referenced from: _decode_frame in libavcodec.a(pngdec.o) _flashsv_decode_frame in libavcodec.a(flashsv.o) _flashsv_decode_frame in libavcodec.a(flashsv.o) _decode_frame in libavcodec.a(lcldec.o) _decode_frame in libavcodec.a(lcldec.o) _decode_frame in libavcodec.a(lcldec.o) _decode_frame in libavcodec.a(tscc.o) _decode_frame in libavcodec.a(zmbv.o) "_theora_comment_init", referenced from: _encode_init in libavcodec.a(libtheoraenc.o) "_vorbis_info_init", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "deflateInit2", referenced from: _encode_frame in libavcodec.a(pngenc.o) "_deflateReset", referenced from: _encode_frame in libavcodec.a(lclenc.o) _encode_frame in libavcodec.a(zmbvenc.o) "_theora_encode_init", referenced from: _encode_init in libavcodec.a(libtheoraenc.o) "_lame_get_framesize", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_vorbis_analysis", referenced from: _oggvorbis_encode_frame in libavcodec.a(libvorbis.o) "_inflateReset", referenced from: _flashsv_decode_frame in libavcodec.a(flashsv.o) _decode_frame in libavcodec.a(lcldec.o) _decode_frame in libavcodec.a(lcldec.o) _decode_frame in libavcodec.a(tscc.o) _decode_frame in libavcodec.a(zmbv.o) "_lame_set_disable_reservoir", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_inflateSync", referenced from: _flashsv_decode_frame in libavcodec.a(flashsv.o) "_vorbis_info_clear", referenced from: _oggvorbis_encode_close in libavcodec.a(libvorbis.o) "_theora_encode_header", referenced from: _encode_init in libavcodec.a(libtheoraenc.o) "_theora_clear", referenced from: _encode_close in libavcodec.a(libtheoraenc.o) "_theora_info_clear", referenced from: _encode_init in libavcodec.a(libtheoraenc.o) "_xvid_plugin_lumimasking", referenced from: _xvid_plugin_lumimasking$non_lazy_ptr in libavcodec.a(libxvidff.o) (maybe you meant: _xvid_plugin_lumimasking$non_lazy_ptr) "_theora_encode_comment", referenced from: _encode_init in libavcodec.a(libtheoraenc.o) "_lame_set_brate", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_theora_encode_YUVin", referenced from: _encode_frame in libavcodec.a(libtheoraenc.o) "_lame_init", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_lame_set_mode", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "deflateInit", referenced from: _encode_init in libavcodec.a(lclenc.o) _encode_init in libavcodec.a(zmbvenc.o) "_vorbis_encode_setup_managed", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_lame_set_quality", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_vorbis_analysis_blockout", referenced from: _oggvorbis_encode_frame in libavcodec.a(libvorbis.o) _oggvorbis_encode_frame in libavcodec.a(libvorbis.o) "_vorbis_analysis_wrote", referenced from: _oggvorbis_encode_frame in libavcodec.a(libvorbis.o) _oggvorbis_encode_frame in libavcodec.a(libvorbis.o) _oggvorbis_encode_close in libavcodec.a(libvorbis.o) "inflateInit", referenced from: _decode_frame in libavcodec.a(pngdec.o) _flashsv_decode_init in libavcodec.a(flashsv.o) _decode_init in libavcodec.a(lcldec.o) _decode_init in libavcodec.a(tscc.o) _decode_init in libavcodec.a(zmbv.o) "_vorbis_comment_clear", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_vorbis_bitrate_addblock", referenced from: _oggvorbis_encode_frame in libavcodec.a(libvorbis.o) "_lame_set_in_samplerate", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_vorbis_encode_ctl", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_x264_param_default", referenced from: _X264_init in libavcodec.a(libx264.o) "_theora_info_init", referenced from: _encode_init in libavcodec.a(libtheoraenc.o) "_vorbis_encode_setup_init", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_vorbis_comment_init", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_vorbis_bitrate_flushpacket", referenced from: _oggvorbis_encode_frame in libavcodec.a(libvorbis.o) _oggvorbis_encode_frame in libavcodec.a(libvorbis.o) "_xvid_plugin_single", referenced from: _xvid_plugin_single$non_lazy_ptr in libavcodec.a(libxvidff.o) (maybe you meant: _xvid_plugin_single$non_lazy_ptr) "_xvid_global", referenced from: _ff_xvid_encode_init in libavcodec.a(libxvidff.o) "_xvid_encore", referenced from: _ff_xvid_encode_close in libavcodec.a(libxvidff.o) _ff_xvid_encode_init in libavcodec.a(libxvidff.o) _ff_xvid_encode_frame in libavcodec.a(libxvidff.o) "_vorbis_encode_setup_vbr", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_lame_set_out_samplerate", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_lame_init_params", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) "_vorbis_block_clear", referenced from: _oggvorbis_encode_close in libavcodec.a(libvorbis.o) "_lame_encode_flush", referenced from: _MP3lame_encode_frame in libavcodec.a(libmp3lame.o) "_x264_encoder_open", referenced from: _X264_init in libavcodec.a(libx264.o) "_lame_close", referenced from: _MP3lame_encode_init in libavcodec.a(libmp3lame.o) _MP3lame_encode_close in libavcodec.a(libmp3lame.o) "_vorbis_dsp_clear", referenced from: _oggvorbis_encode_close in libavcodec.a(libvorbis.o) "_vorbis_analysis_headerout", referenced from: _oggvorbis_encode_init in libavcodec.a(libvorbis.o) "_theora_encode_packetout", referenced from: _encode_frame in libavcodec.a(libtheoraenc.o) _encode_close in libavcodec.a(libtheoraenc.o) ld: symbol(s) not found collect2: ld returned 1 exit status Also whene i use [code] codec = avcodec_find_encoder(CODEC_ID_H264); //CODEC_ID_H264 //codec = avcodec_find_encoder_by_name("mpeg1"); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); }[/code] codec is always null where is my error? best regards

    Read the article

  • iPhone XCODE Programming make a UIWebView Scrollable

    - by Antonio Murgia
    here is the problem! I have a UIWebView in my programs that loads a php page. The problem is that if the page has a lot of lines i cannot see them. I can "scroll" the UIWebView but when I leave the finger from the screen the page comes back to the original state. I don't want to scale pages to fit the view cause if I do that the letters become too small. I would like to find a way to scroll pages how it is possible in Safari. Hope i have explained the problem. Thank you in advance Antonio

    Read the article

  • iPhone: CATiledLayer/UIScrollView wont scroll after zooming and only zooms to anchor point

    - by Brodie4598
    Here is the problem... I am using CA Tiled Layer to display a large jpg. The view loads okay, and when I go to scroll around, it works fine. However, as soon as I zoom in or out once, it scrolls to the top left (to the anchor point) and will not scroll at all. The zooming works fine, but I just cannot scroll. Here is my code: #import <QuartzCore/QuartzCore.h> #import "PracticeViewController.h" @implementation practiceViewController //@synthesize image; - (void)viewDidLoad { NSString *path = [[NSBundle mainBundle] pathForResource:@"H-5" ofType:@"jpg"]; NSData *data = [NSData dataWithContentsOfFile:path]; image = [UIImage imageWithData:data]; CGRect pageRect = CGRectMake(0, 0, image.size.width, image.size.height); CATiledLayer *tiledLayer = [CATiledLayer layer]; tiledLayer.anchorPoint = CGPointMake(0.0f, 1.0f); tiledLayer.delegate = self; tiledLayer.tileSize = CGSizeMake(1000, 1000); tiledLayer.levelsOfDetail = 6; tiledLayer.levelsOfDetailBias = 0; tiledLayer.bounds = pageRect; tiledLayer.transform = CATransform3DMakeScale(1.0f, -1.0f, 0.3f); myContentView = [[UIView alloc] initWithFrame:self.view.bounds]; [myContentView.layer addSublayer:tiledLayer]; UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds]; scrollView.delegate = self; scrollView.contentSize = pageRect.size; scrollView.minimumZoomScale = .2; scrollView.maximumZoomScale = 1; [scrollView addSubview:myContentView]; [self.view addSubview:scrollView]; } - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView { return myContentView; } - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { NSString *path = [[NSBundle mainBundle] pathForResource:@"H-5" ofType:@"jpg"]; NSData *data = [NSData dataWithContentsOfFile:path]; image = [UIImage imageWithData:data]; CGRect imageRect = CGRectMake (0.0, 0.0, image.size.width, image.size.height); CGContextDrawImage (ctx, imageRect, [image CGImage]); } @end

    Read the article

  • Memory management in ObjC/iPhone

    - by Manu
    Hi, I have question in memory management (objective C). There are two ideal scenario. ============================= scenario 1 ======================================== (void) funcA { MyObj *c = [otherObj getMyObject]; [c release]; } -(MyObj *) getMyObject //(this method is available in other OtherObj.m file) { MyObj *temp = [[MyObj alloc] init]; // do smothing here return temp; } ============================= scenario 2 ======================================== (void) funcA { MyObj *c = [otherObj getMyObject]; } -(MyObj *) getMyObject //(this method is available in other OtherObj.m file) { MyObj *temp = [[myObj alloc] init]; // do smothing here return [temp autorelease]; } myObj is holding huge chunk of data. In first scenario I am getting myObj(allocated) from other file so I have to release in my own method. (as per any C/C++ language library ,like strdup will return string duplicate which will realase later by developer not by strdup method). In second scenario I am getting myObj(allocated) from otherObj.m file so otherObj.m file is responsible to release that allocated memory(mean autorelease)? Is it right? Please let me know Which scenario is more efficient and valid as per apple memory guidelines. Please Please don't show me any document link. Thanks Manu

    Read the article

  • iPhone SDK - (void)viewDidLoad { } - Show Progress

    - by Hank Brekke
    I have a long - (void)viewDidLoad { } function that uses the internet to load a page, and whenever the application loads the URL, the screen is black. I have a UIActivityIndicator setup to show that the address is loading, but I don't know how to prevent it from seeming as if the application is not responding, and I don't want to show the network activity indicator [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; because the screen will still be black, just with a loader in the top corner. My code is below: - (void)viewDidLoad { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; email.text = [defaults objectForKey:@"mom_email"]; pass.text = [defaults objectForKey:@"mom_pass"]; if (email.text != nil && pass.text != nil) { [self login:loginBtn]; } } - (IBAction)login:(id)sender { [email resignFirstResponder]; [pass resignFirstResponder]; [loader startAnimating]; // Does nothing though NSString *em = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)email.text,NULL,(CFStringRef)@"!*'();:@&=+$,/?%#[]",kCFStringEncodingUTF8); NSString *ps = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,(CFStringRef)pass.text,NULL,(CFStringRef)@"!*'();:@&=+$,/?%#[]",kCFStringEncodingUTF8); NSURL *url = [[NSURL alloc] initWithScheme:@"http" host:@"localhost" path:[[NSString alloc] initWithFormat:@"/app/login.php?email=%@&pass=%@", em, ps]]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString *loginResult = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; [loader stopAnimating]; NSRange range = [loginResult rangeOfString:@"1"]; if (range.location != NSNotFound) { [self dismissModalViewControllerAnimated:YES]; // Doesn't do anything if function called from viewDidLoad } }

    Read the article

< Previous Page | 167 168 169 170 171 172 173 174 175 176 177 178  | Next Page >