我们覆盖这样的paint方法
public void paint(Graphics g)
{
g.drawString(msg,xpos,ypos);
}
Run Code Online (Sandbox Code Playgroud)
如果我们有另一种方法,可以说一个鼠标按下的事件方法
public void mousePressed(MouseEvent me)
{
xpos=me.getX(); // msg, xpos and ypos are variables of class
ypos= me.getY();
msg="You pressed mouse";
repaint();
}
Run Code Online (Sandbox Code Playgroud)
为什么我们不能称之为油漆(Graphics g)而不是repaint()?
class a
{
a(){System.out.println("A");}
}
class b extends a
{
b()
{
super();
System.out.println("B");}
}
class c extends b
{
c(){System.out.println("c");}
}
class last
{
public static void main(String aaa[])
{
c obj = new c();
}
}
Run Code Online (Sandbox Code Playgroud)
输出来自:
一个
乙
C
不应该是:
一个
一个
乙
C
因为超级关键字
可能重复:
是否有一种将ISO8601时间戳转换为格式化NSDate的简单方法?
如何在objective-c中将字符串转换为日期?
如果我使用read_mailbox权限请求ForGrpahPath:@"me/inbox",那么我得到:
"data": [
{
"id": "XXXXXXXXXXXXXXXXX",
"from": {
"name": "XXXXXXXXXXXX",
"id": "XXXXXXXXXXXXXXX"
},
"message": "yeup!",
"created_time": "2012-12-03T10:28:21+0000" // how to convert this time to normal NSdate
},
Run Code Online (Sandbox Code Playgroud) 下一行的Ascii值是10.所以我尝试了这个......
FileOutputStream os = new FileOutputStream(f, true);
os.write(10); // this should get me to next line ?
os.write(b); // b is a byte array...
Run Code Online (Sandbox Code Playgroud) 我想计算我的位置和一些注释之间的中心点.到目前为止,我已经这样做了:
CLLocation *myLoc = self.locMgr.location;
MKPointAnnotation *middleAnnotation = [locationV.annotations objectAtIndex:locationV.annotations.count/2];
CLLocation *someStuiodLoc = [[CLLocation alloc] initWithLatitude:middleAnnotation.coordinate.latitude longitude:middleAnnotation.coordinate.longitude];
CLLocationDistance dist = [myLoc distanceFromLocation:someStuiodLoc];
Run Code Online (Sandbox Code Playgroud)
如何计算"dist"的中心点/坐标?
使用AVFoundation的方法录制视频时- (void)startRecordingToOutputFileURL:(NSURL*)outputFileURL recordingDelegate:(id<AVCaptureFileOutputRecordingDelegate>)delegate;,如果视频持续时间超过12秒,则输出文件中没有音轨。如果视频时长小于 12 秒,则一切正常...
接收输出文件 URL 的委托是:
- (void)captureOutput:(AVCaptureFileOutput *)captureOutput didFinishRecordingToOutputFileAtURL:(NSURL *)outputFileURL fromConnections:(NSArray *)connections error:(NSError *)error
{
NSLog(@"AUDIO %@", [[AVAsset assetWithURL:outputFileURL] tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]); //App crashes here...
NSLog(@"VIDEO %@", [[AVAsset assetWithURL:outputFileURL] tracksWithMediaType:AVMediaTypeVideo]);
}
Run Code Online (Sandbox Code Playgroud)
我的应用因长度超过 12 秒的视频而崩溃,并出现以下错误:*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Run Code Online (Sandbox Code Playgroud)
System.in(Standard input stream)- 以字节为单位从键盘获取输入
InputStreamReader: 将字节转换为Unicode字符/将标准输入转换为读取器对象以与BufferedReader一起使用
Finally BufferedReader:用于从字符输入流中读取(输入流读取器)
String c = br.ReadLine(); - 一种用于从输入流中读取字符并将其一次性放入字符串中的方法.
一切都在正确吗?如果有什么不对请更正!
class A
{
static int i;
A()
{
System.out.println(++i);
}
public static void main(String h[])
{
A obj[] = new A[30];
}
}
Run Code Online (Sandbox Code Playgroud)
obj [30] =新A [30]; : - 这一行应该调用默认构造函数30次?
我需要这个公式:C(n)= B(n)* A5。(n是行号)
从字面上看,将B列中当前选择的行号乘以A5
我尝试了= ROW函数来创建引用,但失败了。
我尝试使用以下公式:C(2) =MULTIPLY(B=ROW(),A5)认为它将被解析为 C(2) =MULTIPLY(B2,A5)
我写了很多完成块,但不知道为什么会这样。如果我们使用适当的参数调用块,则基于块的函数的控制不应继续进行。但就我而言,它正在这样做。
- (void) validateFormWithCompletion: (void(^)(BOOL valid)) completion
{
if (! [NetworkConstant appIsConnected])
{
[[AppThemeManager sharedInstance] showNoInternetMessage];
completion(NO);
}
emailIdTF.text = [emailIdTF.text trimWhiteSpaceAndNextLine];
if (emailIdTF.text.length == 0)
{
[[AppThemeManager sharedInstance] showNotificationWithTitle:@"Incomplete" subtitle:@"Please fill in a valid email id" duration:durationForTSMessage withTypeOfNotification:notificationWarning];
completion(NO);
}
else
{
completion(YES);
}
}
Run Code Online (Sandbox Code Playgroud)
如果没有 Internet 连接,则控件应从第一次出现完成 (NO); 时返回。但相反,它前进到电子邮件长度检查。我在这里做错了吗?
java ×5
ios ×4
constructor ×2
iphone ×2
applet ×1
avfoundation ×1
awt ×1
excel ×1
inheritance ×1
multiplying ×1
objective-c ×1
outputstream ×1
repaint ×1
swing ×1
timestamp ×1