I have to download a file and I'm using this code, which is basically an AsyncTask that is meant to update a progress bar. But, since I don't know what's the file size I've been having to use the spinner progress bar. So, how can I get the file size before start downloading it so that I can use a normal progress bar?
How do you sketch out your iPhone App designs and ideas? I am currently about to start my next project and want to find a way to get my ideas on screen instead of good old fashioned paper.
Hi,
I have this code:
CGPoint arrowMiddle = CGPointMake((arrowOne.x + arrowTo.x)/2, (arrowOne.y + arrowTo.y)/2);
CGPoint arrowLeft = CGPointMake(arrowMiddle.x-40, arrowMiddle.y);
CGPoint arrowRight = CGPointMake(arrowMiddle.x, arrowMiddle.y + 40);
[arrowPath addLineToScreenPoint:arrowLeft];
[arrowPath addLineToScreenPoint:arrowMiddle];
[arrowPath addLineToScreenPoint:arrowRight];
[[mapContents overlay] addSublayer:arrowPath];
[arrowPath release];
with this output:
http://yfrog.com/edschermafbeelding2010032p
What have i to add to get the left and right the at same degree of the line + 30°.
If someone has the algorithm of drawing an arrow on a line, pleas give it. It doesn't matter what programming language it is...
Thanks
I want a UITextView in cocos2d. I used in init method
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0, windowSize.height/2,windowSize.width/2)];
textView.backgroundColor = [UIColor clearColor];
textView.text = @"I am First enemy";
[textView setEditable:NO];
[[[CCDirector sharedDirector]openGLView]addSubview:textView];
the orientation is
[[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
I need the text to appear in landscape mode, but I am getting the text in following way.
How can I make the text to appear in the landScape mode. I am working in cocos2d. CanOI scroll the text ? What should i add to make the text scroll up and down.
Thank you.
I've been looking at the Stanford University iphone videos on iTunes U. And saw the teacher trying to do something similar to this code but he realised and said it didn't work though I didn't get why:
- (IBAction)flashPressed{
if (window.backgroundColor == [UIColor magentaColor]){
window.backgroundColor = [UIColor redColor];
}else {
window.backgroundColor = [UIColor magentaColor];
}
}
Objective-C, windows based application. Not sure what else you need to know.
Hi,
I'm a new user to this interesting forum!
I want start developing an application for android and before starting i want learn about some android features...
The first android feature is how to correlate finger motion on the screen with java...
Are there any source code examples that show how to draw with your finger on an android screen?
Can you suggest a good place for me to download an example?
thanks
What makes scrolling so choppy on the UITableView when images are loaded? Is it because they need to be added as subviews? Or is it because images need to be cached? Both?
I have a Class that I need to copy with the ability to make changes the value of a variable on both Classes. Simply put the classes need to remain clones of each other at all times. My understanding of the documentation is that I can do this using a shallow copy of the Class which has also been declared mutable. By shallow copying the pointer value for the variable will be cloned so that it is an exact match in both classes. So when I update the variable in the original the copy will be updated simultaneously. Is this right?
As you can see below I have used mutableCopyWithZone in the class I want to copy. I have tried both NSCopyObject and allocWithZone methods to get this to work. Although I'm able to copy the class and it appears as intended, when updating the variable it is not changing value in the copied Class.
- (id)mutableCopyWithZone:(NSZone *)zone {
//ReviewViewer *copy = NSCopyObject(self, 0, zone);
ReviewViewer *copy = [[[self class] allocWithZone:zone] init];
copy->infoTextViews = [infoTextViews copy];
return copy;
}
infoTextViews is a property declared as nonatomic, retain in the header file of the class being copied. I have also implemented the NSMutableCopying protocol accordingly.
Any help would be great.
All,
Has anyone figured out how to return the sql for an object that is in Webi using the rebean api? I have got the ReportExpression of the column but, from there I am having a difficult time retrieving the SQL of the object.
Thanks
I have UITableView. I customized the cell height (increased).
I have 4 labels(UILabel) and 1 image(UIImage) and 3 buttons (UIButton). one of the button is delete button. By touching the cell or button(play button) on the image a video is loaded and played.
I need to delete the cell by touching delete button. If I touched the delete button the corresponding video is deleted from library . But, how to delete the cell and all remaining data in it ? I am not able to delete the cells or the data in the cells.
How to do it ?
Thank you.
I have a UIToolBar *toolbar1. I have 3 buttons on the toolbar. And the tool bar is at the bottom of the view.
The buttons are like library button, moreApps button, recordVideo button. If I touch the library button a new view(a UITableViewController) appears. I used presentModelViewController for it. If I touch moreApps button a new view (a UIViewController) appears and it loaded from http//. The recordButton touch gives another UIViewController view.
When the moreApps button is touched and the view is loaded, it have the content from web and a UIToolBar *toolbar2 at the bottom the view. It has a refresh button and done button.
The problem is when I touch the toolbar2 (not on the refresh button and done button) the previous views button are activated and corresponding views of previous buttons(library button, playVideo button) are loaded. I am not able to understand about this problem.
Thank you.
I am looking for ideas as to how all of you can think to solve this issue. I am going to be using an Android Tablet as basically a touch screen input for a project. I need to be able to control servos and solenoids and such, so I will be using a Raspberry Pi to do this. I am looking for ideas on how to get the tablet and the Raspberry Pi to talk. Here are a few that I have though of so far.
Use Wifi (which I really do not want to, Ethernet would be okay) to ssh into the Raspberry Pi (with an external library) and run scripts that way from the Android app.
Use a com port for Android (maybe Andropod if there hardware becomes available?) and run scripts on the Raspberry Pi.
Those are probably two of the "best" ideas that I can think of for now.
Can anyone think of any other "better" ideas?
Thanks in advance for the help,
Dan
I want to add an image using the cell.imageView setImage: method. However, depending on field from an array (in the form of an NSString and called using [dog types]) I need the image to change to an image which reflects the type of dog.
How do I go about doing this? Thanks.
how does one use code to do this:
produce 15 random numbers that are not in any order, and that only occur once
eg.
1 4, 2, 5, 3, 6, 8, 7, 9, 10, 13, 12, 15, 14, 11
rand() or arc4rand() can repeat some, which is not what im after.
Thanks
I am having a really annoying bug, which yet I don't know how to trace it.
I have an activity with 3 tabs, each populated by adapters build by asynctasks. They are displaying well, navigation is fine. I've extended TabActivity.
But whenever I hit the Back/Menu/Search button it halts, then after a while the OS displays me this warning:
Sorry
Activity Contacts (in application MyApp) is not responding. Force close or Wait.
How can I trace this problem on the phone?
Hi,
ive configured local service under some app.
i wanna know how could i invoke methods on the activity, through the service in a synchronous way for example:
the service invoke a method inthe activity and waiting for for result(synchronous) from it.
(the method exists in the activity)
thanks.
Hello,
In my app I move the table view (in order to make the text fields visible when the keyboard appears). The view is looks following:
This is the code I use for resizing the view and moving it up:
static const NSUInteger navBarHeight = 44;
CGRect appFrame = [[UIScreen mainScreen] applicationFrame];
tableView.frame = CGRectMake(0, navBarHeight, appFrame.size.width, appFrame.size.height-navBarHeight-216); //216 for the keyboard
NSIndexPath *indPath = [self getIndexPathForTextField:textField]; //get the field the view should scroll to
[tableView scrollToRowAtIndexPath:indPath atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
The problem is that when the view is moved up it also moves 3 pixels into right direction (it is hard to see the difference in the screenshot, but it is visible when the animation is on and I measured the difference with PixelStick tool). Here it is how it looks after the move:
My analysis shows that scrolling the table does not influence the move to the right.
Any ideas what is wrong in the code above that makes the view move to the right?
hi any one know iphone uislider with two thumbsindicators, i have tried to manipulate it, any one have idea means please guide me. Am new to iphone development please help me.
thanks in advance
I want to resize my table view cells from inside the cell instead of from the UITableViewDelegate. I am resizing them based on asynchronous content, so I can't size them in the delegate.
I tried setting self.frame inside the cell, but the table view was really unhappy about that. Cells were overlapping and all kinds of craziness was going on.
I am presenting a UIViewController as a modal viewcontroller with modalPresentationStyle = UIModalPresentationFormSheet. I have few UITextFields on its view.
My issue is that when I try to dismiss the keyboard ([textfieldname resignFirstResponder]), it doesn't do anything. However when I change the modalPresentationStyle to UIModalPresentationPageSheet, it works.
This seems to be a bug. Has any one faced similar problems and found a work around? Could I be doing anything dumb and silly?
Hi everyone,
I currently have a very simple view which displays info from a JSON feed. The problem I'm facing is the few second pause I encounter once I press this tab. How can I make this view load instantly and then have the label.text areas load after? Preferable with an activity indicator?
Should I use threads?
Thanks in advance!
Code:
- (NSString *)stringWithUrl:(NSURL *)url {
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadRevalidatingCacheData timeoutInterval:30];
NSData *urlData;
NSURLResponse *response;
NSError *error;
urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
return [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding];
}
- (id)objectWithUrl:(NSURL *)url {
SBJsonParser *jsonParser = [SBJsonParser new];
NSString *jsonString = [self stringWithUrl:url];
return [jsonParser objectWithString:jsonString error:NULL];
}
- (NSDictionary *)downloadStats {
id response = [self objectWithUrl:[NSURL URLWithString:@"http://www.example.com/JSON"]];
NSDictionary *feed = (NSDictionary *)response;
return feed;
[feed release];
}
- (void)viewDidLoad {
[super viewDidLoad];
[GlobalStatsScrollView setScrollEnabled:YES];
[GlobalStatsScrollView setContentSize:CGSizeMake(320, 360)];
}
- (void)viewWillAppear:(BOOL)animated {
NSLog(@"View appears");
// Download JSON Feed
NSDictionary *feed = [self downloadStats];
totalproduced.text = [feed valueForKey:@"Produced"];
totalno.text = [feed valueForKey:@"Total"];
mostcommon.text = [feed valueForKey:@"Most Common"];
}
I've been using this method for a few weeks now as suggested on my previous question and the app now keeps crashing with a Protocol 443 error - something about unable to resolve the address.
Worked fine when first installed and then just stopped. The same with on the device itself, worked fine until this morning and now the same issue?? Nothing wrong with the URL as I can still load in a browser.
If I leave it for a couple of days it starts working again?? Is there a more effecient way of using the Http POST and GET functions? All I am trying to do is perform a login and save the resulting page to a string.
Is there a more Android friendly way?