FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
mycode/BlogApp/BlogApp/BlogAppViewController.m at master · apueee/mycode · GitHub
apueee
/
mycode
Public
forked from
jsj2008/mycode
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
mycode
/
BlogApp
/
BlogApp
/
BlogAppViewController.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
168 lines (129 loc) · 4.5 KB
Breadcrumbs
mycode
/
BlogApp
/
BlogApp
/
BlogAppViewController.m
Copy path
File metadata and controls
168 lines (129 loc) · 4.5 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//
//
BlogAppViewController.m
//
BlogApp
//
//
Created by Ayush Goel on 11/07/11.
//
Copyright 2011 __MyCompanyName__. All rights reserved.
//
#
import
"
BlogAppViewController.h
"
#
import
"
WebServiceHandler.h
"
#
import
"
WebServicePost.h
"
@implementation
BlogAppViewController
- (
void
)
dealloc
{
[
super
dealloc
];
}
- (
void
)
didReceiveMemoryWarning
{
//
Releases the view if it doesn't have a superview.
[
super
didReceiveMemoryWarning
];
//
Release any cached data, images, etc that aren't in use.
}
#
pragma mark
- View lifecycle
WebServiceHandler *obj;
//
Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (
void
)
viewDidLoad
{
first=
0
;
[[
NSNotificationCenter
defaultCenter
]
addObserver:
self
selector:
@selector
(
castDict
)
name:
@"
unique
"
object:
nil
];
NSURL
*url = [
NSURL
URLWithString:
@"
http://localhost/xampp/aayush1.php
"
];
obj=[[WebServiceHandler
alloc
]initWithWord:url];
blogView=[[UITextField
alloc
]initWithFrame:
CGRectMake
(
0
,
0
,
320
,
300
)];
[
self
.view
addSubview:
blogView];
[blogView
release
];
blogView.
hidden
=
YES
;
save = [UIButton
buttonWithType:
UIButtonTypeRoundedRect];
save.
frame
=
CGRectMake
(
100
,
350
,
100
,
50
);
[save
setTitle:
@"
save
"
forState:
UIControlStateNormal];
[save
addTarget:
self
action:
@selector
(
onSave
)
forControlEvents:
UIControlEventTouchUpInside];
[save
setUserInteractionEnabled:
YES
];
[
self
.view
addSubview:
save];
[
self
performSelector:
@selector
(
Datareload
)
withObject:
nil
afterDelay:
3.0
];
[
super
viewDidLoad
];
}
-(
void
)
Datareload
{
NSURL
*url = [
NSURL
URLWithString:
@"
http://localhost/xampp/aayush1.php
"
];
obj=[[WebServiceHandler
alloc
]initWithWord:url];
[myTable
reloadData
];
[
self
performSelector:
@selector
(
Datareload
)
withObject:
nil
afterDelay:
3.0
];
}
-(
void
)
onSave
{
blogView.
hidden
=
YES
;
myTable.
hidden
=
NO
;
NSString
*key=[keyArray
objectAtIndex:
selected];
[result
setValue:
blogView.text
forKey:
key];
NSURL
*url1 = [
NSURL
URLWithString:
@"
http://localhost/xampp/aayush2.php
"
];
WebServicePost *obj1=[[WebServicePost
alloc
]initWithRequest:url1
aDict:
result];
[obj1
release
];
}
-(
void
)
castDict
{
result=[obj
returnData
];
[result
retain
];
[obj
release
];
if
(first==
0
)
{
myTable=[[UITableView
alloc
]initWithFrame:
CGRectMake
(
0
,
0
,
320
,
480
)
style:
UITableViewStylePlain];
myTable.
delegate
=self;
myTable.
dataSource
=self;
[
self
.view
addSubview:
myTable];
first=
1
;
}
[UIApplication
sharedApplication
].
networkActivityIndicatorVisible
=
NO
;
}
- (
NSInteger
)
numberOfSectionsInTableView
:
(UITableView *)
tableView
{
//
Return the number of sections.
return
1
;
}
- (
NSInteger
)
tableView
:
(UITableView *)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
//
Return the number of rows in the section.
return
[result
count
];
}
//
Customize the appearance of table view cells.
- (UITableViewCell *)
tableView
:
(UITableView *)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
static
NSString
*CellIdentifier =
@"
Cell
"
;
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:
CellIdentifier];
if
(cell ==
nil
) {
cell = [[[UITableViewCell
alloc
]
initWithStyle:
UITableViewCellStyleDefault
reuseIdentifier:
CellIdentifier]
autorelease
];
}
keyArray=[result
allKeys
];
keyArray = [keyArray
sortedArrayUsingSelector:
@selector
(
localizedCaseInsensitiveCompare:
)];
[keyArray
retain
];
//
NSLog(@"keyArray== %@",keyArray);
cell.
textLabel
.
text
=[keyArray
objectAtIndex:
indexPath.row];
return
cell;
}
#
pragma mark
-
#
pragma mark
Table view delegate
- (
void
)
tableView
:
(UITableView *)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
myTable.
hidden
=
YES
;
blogView.
hidden
=
NO
;
NSString
*key=[keyArray
objectAtIndex:
indexPath.row];
selected=indexPath.
row
;
blogView.
text
= [result
objectForKey:
key];
blogView.
delegate
=self;
}
- (
BOOL
)
textFieldShouldReturn
:
(UITextField *)
textField
{
[textField
resignFirstResponder
];
return
NO
;
}
- (CGFloat)
tableView
:
(UITableView *)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*)
indexPath
{
return
44
;
}
- (
void
)
viewDidUnload
{
[
super
viewDidUnload
];
//
Release any retained subviews of the main view.
//
e.g. self.myOutlet = nil;
}
- (
BOOL
)
shouldAutorotateToInterfaceOrientation
:
(UIInterfaceOrientation)
interfaceOrientation
{
//
Return YES for supported orientations
return
(interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
Back
|
FazBrowse Home
|
New Git URL