cocoa-touch

Prevent subview from scrolling in a UIScrollView

戏子无情 提交于 2020-01-14 12:40:14
问题 I have a UIScrollView subclass with a certain subview I'd like to prevent from scrolling (while all the other subviews scroll as normal). The closest example to this I can think of is UITableView 's "index strip" on the right side (look in the Contacts app to see an example). I am guessing this is a subview of the table (scrollview) but it does not move as the user scrolls. I can't seem to make my subview stay put! How can I accomplish this? 回答1: The trick is to adjust the frame of the "non

How to programmatically highlight a UIButton?

南楼画角 提交于 2020-01-14 12:13:13
问题 I've had a lot of users complain that the little "i" info button is difficult to touch on the iPhone. Ok, simple enough -- I just stuck a big-fat invisible button behind it that you can't miss even with the sloppiest of finger touches and, when you touch it, it does the infoButtonAction. Thing is, I'd like to flash the info button, itself, for about .25 sec, just to give a visual "this is what's going on" type of feedback. I mean, I'm already assuming that you meant to hit the "i" button, so

why eventsMatchingPredicate returns nil?

江枫思渺然 提交于 2020-01-14 10:38:52
问题 Here's my code: NSString * calID = [[NSUserDefaults standardUserDefaults] objectForKey:@"calendarIdentifier"]; EKCalendar *cal = [eventStore calendarWithIdentifier:calID]; // If calendar exists if(cal) { // Retrieve all existing events until today NSPredicate *predicate = [eventStore predicateForEventsWithStartDate:[NSDate distantPast] endDate:[NSDate date] calendars:@[cal]]; self.events = [eventStore eventsMatchingPredicate:predicate]; if(self.events==nil) NSLog(@"nil events!"); } The

Using NSDate in While loop

橙三吉。 提交于 2020-01-14 10:16:16
问题 I want to get the current date using [NSDate date] in a While Loop. I accomplish this by doing like this: while (interval > 0.0) { NSDate *currentDate = [[NSDate alloc] init]; currentDate = [NSDate date]; interval = (float) [newDate timeIntervalSinceDate: currentDate] / 60; [currentDate release]; } I dont know why is the Memory leaks shows that there is a great amount of memory is leaked. Kindly guide me that what is the right way to accomplish my task. 回答1: The problem is not that you are

UISegmentedControl selected index always 0?

给你一囗甜甜゛ 提交于 2020-01-14 09:22:12
问题 I have a UISegmentedControl that has 6 segments which I created in Interface Builder. I am calling the following method on value changed: -(IBAction)segmentedChartButtonChanged:(id)sender { switch (self.segmentedChartButton.selectedSegmentIndex) { case 0: NSLog(@"5d selected. Index: %d", self.segmentedChartButton.selectedSegmentIndex); break; case 1: NSLog(@"3m selected. Index: %d", self.segmentedChartButton.selectedSegmentIndex); break; default: break; } } Whenever I change the segments, the

Setting UITabBarItem title from UINavigationController?

末鹿安然 提交于 2020-01-14 07:49:08
问题 I have setup a UITabBarController with two tabs, one is a simple UIViewController and the other is a UINavigationController using a second UIViewController as its rootController (this will later be used to setup a UITableView). My question is with regard to naming the tabs (i.e. setting the title of each UITabBarItem) For the first tab (simple UIViewController) I have added the following (see below) to the controllers -init method. // FROM -[MapController init] - (id)init { self = [super init

Upload Image in to server

偶尔善良 提交于 2020-01-14 06:38:12
问题 This my code from this link Uploading Image via POST in Objective C // COnvert Image to NSData NSData *dataImage = UIImageJPEGRepresentation(_chosenImage, 1.0f); NSLog(@"%@", dataImage); NSString *tempURLString = [APIStr stringByReplacingOccurrencesOfString:@"***" withString:@"upload"]; // set your URL Where to Upload Image NSString *urlString = @"My URL String"; // set your Image Name NSString *filename = @"My File Name"; // Create 'POST' MutableRequest with Data and Other Image Attachment.

UITableViewCell as progress indicator

南笙酒味 提交于 2020-01-14 06:12:07
问题 I am trying to set the whole cell background view to show a progress indicator. if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"Cell"]; UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; cell.backgroundView = progressView; [progressView setFrame:cell.bounds]; } this does not set the progress bar to the whole cell, but just the top part of the cell. Should I make the cell

Steps to test iphone app on device (profile/certificate already created)

跟風遠走 提交于 2020-01-14 06:06:10
问题 I want to test my app on my itouch which has ios 4.2.1 . I have completed the steps for provisioning profile/certificate. So under Organizer, when I select my device, I am seeing the provisioning profile and under Developer profile, I see 2 entries; iPhone Developer and iPhone Distributor Now I want to just test the app on my device (NOT looking for steps to submit the app for distribution at this stage) I think there are some Project settings that I need to do under XCode. But I am unable to

iOS - Button tap animation in UIScrollView

夙愿已清 提交于 2020-01-14 06:05:30
问题 So I have a main view that is a UIScrollView, and I add all of my elements (UIButtons, UITextFields, UILabels etc. etc.) to it. The problem I am having, is that when I go to tap a button, the button will perform the action(s) that it is supposed to, however I will not see the pressed animation occur. I can only see the animation if I press and hold for about half a second. I believe this has something to do with the fact that the UIScrollView seems to think I am trying to scroll at first, but